查找 SVM 模型的 AUC 分数 [英] Finding AUC score for SVM model

查看:39
本文介绍了查找 SVM 模型的 AUC 分数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道支持向量机算法不计算概率,这是找到 AUC 值所需的,还有其他方法可以找到 AUC 分数吗?

I understand that Support Vector Machine algorithm does not compute probabilities, which is needed to find the AUC value, is there any other way to just find the AUC score?

from sklearn.svm import SVC
model_ksvm = SVC(kernel = 'rbf', random_state = 0)
model_ksvm.fit(X_train, y_train)

model_ksvm.predict_proba(X_test)

我无法得到 SVM 算法的概率输出,没有概率输出我无法得到 AUC 分数,而我可以用其他算法得到.

I can't get the the probability output from the SVM algorithm, without the probability output I can't get the AUC score, which I can get with other algorithm.

推荐答案

对于 ROC,您实际上不需要概率,只需要任何类型的置信度分数.您需要根据样本属于正类的可能性对样本进行排序.支持向量机可以为此目的使用与分离平面的(有符号)距离,实际上 sklearn 在使用 AUC 评分时会在幕后自动执行此操作:它使用 decision_function方法,即有符号距离.

You don't really need probabilities for the ROC, just any sort of confidence score. You need to rank-order the samples according to how likely they are to be in the positive class. Support Vector Machines can use the (signed) distance from the separating plane for that purpose, and indeed sklearn does that automatically under the hood when scoring with AUC: it uses the decision_function method, which is the signed distance.

您还可以在 SVC 中设置 probability 选项(docs),它在 SVM 之上拟合 Platt 校准模型以产生概率输出:

You can also set the probability option in the SVC (docs), which fits a Platt calibration model on top of the SVM to produce probability outputs:

model_ksvm = SVC(kernel='rbf', probability=True, random_state=0)

但这会导致相同的 AUC,因为 Platt 校准只是将符号距离单调地映射到概率.

But this will lead to the same AUC, because the Platt calibration just maps the signed distances to probabilities monotonically.

这篇关于查找 SVM 模型的 AUC 分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆