from sklearn.metric import roc_curve,auc
import matplotlib.pyplot as plt
fpr,tpr,_ = roc_curve(y_true,y_pred)
area = auc(fpr,tpr)
plt.plot(fpr,tpr,lw =1,alpha=0.8,label = 'ROC (AUC=%2F)'%(area))
plt.plot([0,1],[0,1],linestyle = '--',lw=2,color = 'r',label = 'Chance',alpha = 0.8)
plt.xlim([-0.05,1.05])
plt.ylim([-0.05,1.05])
# plt.xlabel('False Positive Rate')
plt.xlabel('!!')
# plt.ylabel('True Positive Rate')
plt.ylabel('!!')
# plt.title('Receiver Operating Curve')
plt.title('ROC-Curve')
plt.legend(loc='lower right')
plt.savefig('roc_prognosis.pdf',dpi = 300)#保存成PDF图片
ROC曲线
最新推荐文章于 2022-01-06 15:58:10 发布