【发布时间】:2019-12-26 06:57:15
【问题描述】:
我使用了来自 sklearn.metrics 的 roc_curve。我看到了这个错误:
我有一个二元分类器的结果 (true_labels ={0,1})。我需要绘制 ROC 曲线。于是我写了:
X, Y, thresholds = sklearn.metrics.roc_curve(true_labels, prediction_scores, pos_label=1)
我看到这个错误:
raise ValueError("{0} format is not supported".format(y_type))
ValueError: multilabel-indicator format is not supported
任何帮助将不胜感激!
【问题讨论】:
-
true_labels应该是与prediction_scores长度相同的整数列表。prediction_scores包含分类的分数(浮点值可能在0和1之间),true_labels包含基本事实标签(每个条目应该是0或1)。 -
@jodag 他们就像你说的那样。 true_labels 和 prediction_scores 都是 numpy.ndarray。这会是问题吗?
-
应该没问题。我的猜测是他们有一个额外的维度或其他东西。你能检查
true_labels.shape和prediction_scores.shape吗? -
@jodag 是的!这就是问题所在。它现在正在工作。你会发布你的答案,以便我接受并评价它吗?
标签: python scikit-learn roc