utils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:drnns-prediction 作者: jvpoulos 项目源码 文件源码
def plot_ROC(actual, predictions):
    # plot the FPR vs TPR and AUC for a two class problem (0,1)
    import matplotlib.pyplot as plt
    from sklearn.metrics import roc_curve, auc

    false_positive_rate, true_positive_rate, thresholds = roc_curve(actual, predictions)
    roc_auc = auc(false_positive_rate, true_positive_rate)

    plt.title('Receiver Operating Characteristic')
    plt.plot(false_positive_rate, true_positive_rate, 'b',
    label='AUC = %0.2f'% roc_auc)
    plt.legend(loc='lower right')
    plt.plot([0,1],[0,1],'r--')
    plt.xlim([-0.1,1.2])
    plt.ylim([-0.1,1.2])
    plt.ylabel('True Positive Rate')
    plt.xlabel('False Positive Rate')
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号