#评价指标输出
y_pred = model.predict(x_test)
y_test=data.label
def do_metrics(y_test,y_pred):
    plot_auc(y_test,y_pred)

#auc计算并生成图形
def plot_auc(y_test,y_pred):
    print("auc:")
    fpr, tpr, thread = metrics.roc_curve(np.array(y_test), np.array(y_pred))
    x=metrics.auc(fpr, tpr)
    print(x)
    plt.title("ROC curve of %s (AUC = %.4f)" % ('lightgbm', x))
    plt.xlabel("False Positive Rate")
    plt.ylabel("True Positive Rate")
    plt.plot(fpr,tpr)  # use pylab to plot x and y
    plt.show()  # show the plot on the screen

python roc_curve和auc的打印并形成图形

相关文章:

  • 2021-05-08
  • 2022-02-27
  • 2022-12-23
  • 2021-05-18
  • 2021-05-03
  • 2021-05-13
  • 2021-12-15
  • 2021-11-11
猜你喜欢
  • 2022-12-23
  • 2021-04-29
  • 2022-01-17
  • 2021-09-02
  • 2022-02-11
  • 2022-12-23
  • 2021-10-10
相关资源
相似解决方案