ValueError: Data is not binary and pos_label is not specified for roc_curve

Viewed 12370

I'm trying to calculate roc_curve but I got this error message

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

My code

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: Not really understand this solution (ValueError: Data is not binary and pos_label is not specified) because it seems not really related.

1 Answers
Related