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

#评价指标输出
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的打印并形成图形