How can we build a ROC curve for customized ANN Model on Python?

后端 未结 1 784
情话喂你
情话喂你 2021-01-28 13:08

I am trying to build a customized ANN Model on Python. My method, where I have built the model, is as follows:

def binary_class(x_train,nodes,activation,n):
  #C         


        
1条回答
  •  鱼传尺愫
    2021-01-28 13:44

    Something like this should do the trick:

    from sklearn import metrics
    
    fpr, tpr, thresholds = metrics.roc_curve(true_values, predicted_values, pos_label=1)
    roc_auc = metrics.auc(fpr, tpr)
    
    lw = 2
    plt.figure()
    plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--', alpha=0.15)
    plt.plot(fpr, tpr, lw=lw, label=f'ROC curve (area = {roc_auc: 0.2f})')
    
    plt.xlabel('(1–Specificity) - False Positive Rate')
    plt.ylabel('Sensitivity - True Positive Rate')
    plt.title(f'Receiver Operating Characteristic')
    plt.legend(loc="lower right")
    plt.show()
    

    0 讨论(0)
提交回复
热议问题