sklearn ROC示例中的fpr,tpr计算中的“ ValueError:没有足够的值要解压预期3,得到2”

问题描述

我的代码绘制ROC曲线,

'''

true = y_true
pred = preds[:,0]
fpr = dict()
tpr = dict()
roc_auc = dict()
for i in range(2):
    fpr[i],tpr[i],_ = roc_curve(true,pred)
    roc_auc[i] = auc(fpr[i],tpr[i])

print(roc_auc_score(test,pred))
plt.figure()
plt.plot(fpr[1],tpr[1])
plt.xlim([0.0,1.0])
plt.ylim([0.0,1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver operating characteristic')
plt.show()

'''

但是,在fpr,tpr计算的for循环中,我收到错误“ ValueError:没有足够的值要解包(预期3,得到2)”。有什么想法我做错了吗?谢谢您的时间。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)