我很难在 python 中绘制 OneClassSVM 的 AUC 图(我正在使用 sklearn 生成混淆矩阵[[tp, fp],[fn,tn]]
,如fn=tn=0
.
from sklearn.metrics import roc_curve, auc
fpr, tpr, thresholds = roc_curve(y_test, y_nb_predicted)
roc_auc = auc(fpr, tpr) # this generates ValueError[1]
print "Area under the ROC curve : %f" % roc_auc
plt.plot(fpr, tpr, label='ROC curve (area = %0.2f)' % roc_auc)
我想处理错误 [1] 并AUC
为OneClassSVM
.
[1] ValueError: Input contains NaN, infinity or a value too large for dtype('float64').