如何使用 roc_auc_score 更改情节图例?

How to change plot legends with roc_auc_score?

我正在用 scikit-learnplot_roc_curve 绘制 ROC 曲线,该曲线图例是自动打印的。有办法改变它们吗?

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

您几乎可以将任何您喜欢的东西添加到通过 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")

这将 return: