def make_curve(x, y, xlabel, ylabel, filename):
"""Draw and save ROC or PR curves."""
auc = np.trapz(x, y, dx=0.001) # area under the curve
sns.plt.figure()
sns.plt.clf()
sns.plt.plot(x, y)
sns.plt.xlim([0, 1])
sns.plt.ylim([0, 1])
sns.plt.xlabel(xlabel)
sns.plt.ylabel(ylabel)
sns.plt.title("AUC: {}".format(auc))
sns.plt.savefig(filename)
return auc
评论列表
文章目录