如何平滑ROC曲线?

问题描述

我使用以下代码绘制了不同分类器的 ROC 曲线,但在所有图中(来自不同分类器),图表都是三角形的,如下例所示。我怎样才能有一个更平滑的情节?

def plot_roc_curve(fpr,tpr,classifier):
    plt.plot(fpr,color='orange',label='ROC')
    plt.plot([0,1],[0,color='darkblue',linestyle='--')
    plt.xlabel('False Positive Rate')
    plt.ylabel('True Positive Rate')
    plt.title(str(classifier) + 'Receiver Operating Characteristic (ROC) Curve ')
    plt.legend(loc="lower right")
    plt.show()

from sklearn.metrics import roc_curve
fpr,thresholds = roc_curve(y_test,y_predicted)
plot_roc_curve(fpr,key)

我得到了什么:

ROC curve

我想要的:

ROC curve

数据集:https://www.file.io/download/Aq7LT88NBVSh

y_test 
36     1
988    0
416    1
300    1
860    0
      ..
780    0
130    1
316    1
577    0
694    0

y_predict
[1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 1 1 0 0 0 0 0 1 0
 1 1 0 0 0 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 0 0 1 1 0
 1 1 0 1 1 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1 0 1 0 1 1 0 1 0 1 1 0 1 1
 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 0 1
 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 1 1 0 1
 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 1
 1 1 1]

解决方法

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

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

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