【发布时间】:2021-10-04 16:35:35
【问题描述】:
我正在尝试使用 https://scikit-learn.org/stable/modules/generated/sklearn.metrics.RocCurveDisplay.html#sklearn.metrics.RocCurveDisplay.from_predictions 中介绍的 sklearn 函数 RocCurveDisplay.from_predictions。 我这样运行函数:
from sklearn.metrics import RocCurveDisplay
true = np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.])
prediction = np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 0., 0., 0.,
1., 1., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 1., 1., 0., 0.])
RocCurveDisplay.from_predictions(true,prediction)
plt.show()
我收到错误消息“AttributeError: type object 'RocCurveDisplay' has no attribute 'from_predictions'”。
这是版本问题吗?我正在使用最新的 0.24.1
【问题讨论】:
标签: python scikit-learn roc