【发布时间】:2016-06-27 11:17:18
【问题描述】:
我正在尝试计算 roc_curve 但收到此错误消息
Traceback (most recent call last):
File "script.py", line 94, in <module>
fpr, tpr, _ = roc_curve(y_validate, status[:,1])
File "/usr/local/lib/python2.7/site-packages/sklearn/metrics/ranking.py", line 501, in roc_curve
y_true, y_score, pos_label=pos_label, sample_weight=sample_weight)
File "/usr/local/lib/python2.7/site-packages/sklearn/metrics/ranking.py", line 308, in _binary_clf_curve
raise ValueError("Data is not binary and pos_label is not specified")
ValueError: Data is not binary and pos_label is not specified
我的代码
status = rf.predict_proba(x_validate)
fpr, tpr, _ = roc_curve(y_validate, status[:,1]) //error generated here
roc_auc = auc(fpr, tpr)
print roc_auc
P.S:不太了解这个解决方案 (ValueError: Data is not binary and pos_label is not specified),因为它似乎并不真正相关。
【问题讨论】:
标签: python machine-learning scikit-learn