ValueError:数据不是二进制且未指定pos_label

ValueError:数据不是二进制且未指定pos_label,第1张

ValueError:数据不是二进制且未指定pos_label

您只需要进行更改即可

y_true
,如下所示:

y_true=np.array([0, 1, 0, 0, 1, 1, 1, 1, 1])

说明: 如果查看一下https://github.com/scikit-learn/scikit-
learn/blob/0.15.X/sklearn/metrics/metrics.py中的

roc_auc_score
功能,您将看到其评估如下:
y_true

classes = np.unique(y_true)if (pos_label is None and not (np.all(classes == [0, 1]) or np.all(classes == [-1, 1]) or np.all(classes == [0]) or np.all(classes == [-1]) or np.all(classes == [1]))):    raise ValueError("Data is not binary and pos_label is not specified")

在执行的时刻

pos_label
None
,但是只要您将
y_true
字符定义为一个字符数组,并且
np.all
它们总是
false
否定,并且所有条件都被否定,则if条件为,
true
并且引发异常。



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5640021.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存