【问题标题】:How to change plot legends with roc_auc_score?如何使用 roc_auc_score 更改情节图例?
【发布时间】:2021-05-26 01:11:32
【问题描述】:

我正在用plot_roc_curve 或scikit-learn 绘制ROC 曲线,该曲线图例会自动打印。有没有办法改变它们?

metrics.plot_roc_curve(classifier, X_test, y_test, ax=plt.gca())

【问题讨论】:

    标签: python plot scikit-learn roc auc


    【解决方案1】:

    您几乎可以将任何您喜欢的内容添加到通过plot_roc_curve 生成的绘图对象中。例如,您可以执行以下操作:

    plot_roc_curve(classifier, X_test, y_test, ax=plt.gca(), label="Legend")
    plt.xlabel("Your x label text")
    plt.ylabel("Your y label text")
    plt.title("Some title")
    

    这将返回:

    【讨论】:

    • 谢谢。我可以编辑部分自动生成的图例并保留分数吗?例如将LogisticRegression (AUC = 0.82) 转换为LR (AUC = 0.82)。
    • @Flodude 试试name='LR'.
    猜你喜欢
    • 2020-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-09
    • 1970-01-01
    • 1970-01-01
    • 2014-08-01
    • 1970-01-01
    相关资源
    最近更新 更多