我正在使用matplotlib通过以下代码绘制用于10倍交叉验证的接收器工作特性: plt.rcParams [“ figure.figsize”] =(5,5)
for i1 in range(10):
plt.plot(fpr_list[i1], tpr_list[i1], lw=1, alpha=0.3,label='ROC fold %d (AUC = %0.2f)' % (i1, aucs[i1]))
plt.legend(bbox_to_anchor=(1.05, 1), loc=0)
plt.plot([0, 1], [0, 1], linestyle='--', lw=2, color='r',
label='Mid Line', alpha=.8)
mean_tpr = np.mean(tprs, axis=0)
mean_tpr[-1] = 1.0
mean_auc = auc(mean_fpr, mean_tpr)
std_auc = np.std(aucs)
plt.plot(mean_fpr, mean_tpr, color='b',
label=r'Mean ROC (AUC = %0.2f $\pm$ %0.2f)' % (mean_auc, std_auc),
lw=2, alpha=.8)
std_tpr = np.std(tprs, axis=0)
tprs_upper = np.minimum(mean_tpr + std_tpr, 1)
tprs_lower = np.maximum(mean_tpr - std_tpr, 0)
plt.fill_between(mean_fpr, tprs_lower, tprs_upper, color='grey', alpha=.2,
label=r'$\pm$ 1 std. dev.')
plt.xlim([-0.05, 1.05])
plt.ylim([-0.05, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver operating characteristic')
plt.legend(bbox_to_anchor=(1.05, 1), loc=0)
plt.show()
我从程序中获得了