Skip to content
Snippets Groups Projects
Commit 1c7e2228 authored by Thomas Weber's avatar Thomas Weber
Browse files

Write AUC into plot legends

parent cbdbdefc
No related branches found
No related tags found
No related merge requests found
......@@ -20,9 +20,10 @@ def overlay_ROC(filename, *projects):
for p in projects:
fpr, tpr, threshold = roc_curve(p.y_test, p.scores_test, sample_weight = p.w_test)
fpr = 1.0 - fpr
roc_auc = auc(tpr, fpr)
plt.grid(color='gray', linestyle='--', linewidth=1)
plt.plot(tpr, fpr, label=p.name)
plt.plot(tpr, fpr, label=str(p.name+" (AUC = {})".format(roc_auc)))
plt.xlim(0,1)
plt.ylim(0,1)
......
......@@ -499,7 +499,7 @@ class KerasROOTClassification(object):
roc_auc = auc(tpr, fpr)
plt.grid(color='gray', linestyle='--', linewidth=1)
plt.plot(tpr, fpr, label='NN')
plt.plot(tpr, fpr, label=str(self.name + " (AUC = {})".format(roc_auc)))
plt.plot([0,1],[1,0], linestyle='--', color='black', label='Luck')
plt.ylabel("Background rejection")
plt.xlabel("Signal efficiency")
......@@ -509,7 +509,6 @@ class KerasROOTClassification(object):
plt.xticks(np.arange(0,1,0.1))
plt.yticks(np.arange(0,1,0.1))
plt.legend(loc='lower left', framealpha=1.0)
plt.text(0.21,0.02,"AUC: {}".format(str(roc_auc)), size=12)
plt.savefig(os.path.join(self.project_dir, "ROC.pdf"))
plt.clf()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment