向AUC Cu添加更多点数

2024-09-27 00:18:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我设法为AUC绘制了一条曲线,但似乎只有一个点改变了它的方向,而不是曲线

我在函数图上找不到任何地方可以添加更多点,因此我不确定从何处开始

# Calculate roc curve
fpr7, tpr7, thresholds = roc_curve(y_test, y_test_pred7)
fpr3, tpr3, thresholds = roc_curve(y_test, y_test_pred3)

# plot the roc curve for the model
plt.plot(fpr7,tpr7,marker='.',label="Teacher Random Forest",color="red")
plt.plot(fpr3, tpr3, marker='.',label="Student Random Forest",color="blue",dashes=[6, 2])
plt.legend(loc=4)
plt.xlim(0,1)
plt.ylim(0,1)
plt.gca().set_aspect('equal', adjustable='box')
plt.xlabel('False Positive Rate', fontsize=10)
plt.ylabel('True Positive Rate', fontsize=10)
# save the plot
plt.savefig('Teacher_student_AUC_Cancer.png', bbox_inches='tight')

我期待着一个曲线,但它只是一个陡峭的斜坡,有一个改变方向的点。任何帮助都非常感谢

enter image description here


Tags: thetestplotplt曲线markerlabelroc

热门问题