From ce8f554410fccc75290ca9749221dce6d6f64072 Mon Sep 17 00:00:00 2001 From: Eric Schanet <eric.schanet@cern.ch> Date: Fri, 27 Apr 2018 15:43:20 +0200 Subject: [PATCH] Fixing ROC curve plotting --- .gitignore | 3 +++ toolkit.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c192842..1c28bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ outputs/ +setup.sh +run.py *.swp +*.pyc diff --git a/toolkit.py b/toolkit.py index 1f86123..05dfb0e 100755 --- a/toolkit.py +++ b/toolkit.py @@ -353,16 +353,17 @@ class KerasROOTClassification: if not os.path.exists(plot_dir): os.mkdir(plot_dir) fig.savefig(os.path.join(plot_dir, "var_{}.pdf".format(var_index))) - + plt.clf() def plot_ROC(self): logger.info("Plot ROC curve") fpr, tpr, threshold = roc_curve(self.y_test, self.scores_test, sample_weight = self.w_test) + fpr = 1.0 - fpr plt.grid(color='gray', linestyle='--', linewidth=1) plt.plot(fpr, tpr, label='NN') - plt.plot([0,1],[0,1], linestyle='--', color='black', label='Luck') + plt.plot([0,1],[1,0], linestyle='--', color='black', label='Luck') plt.xlabel("False positive rate (background rejection)") plt.ylabel("True positive rate (signal efficiency)") plt.title('Receiver operating characteristic') -- GitLab