Skip to content
Snippets Groups Projects
Unverified Commit ce8f5544 authored by Eric Schanet's avatar Eric Schanet
Browse files

Fixing ROC curve plotting

parent 77dd63a5
No related branches found
No related tags found
No related merge requests found
outputs/ outputs/
setup.sh
run.py
*.swp *.swp
*.pyc
...@@ -353,16 +353,17 @@ class KerasROOTClassification: ...@@ -353,16 +353,17 @@ class KerasROOTClassification:
if not os.path.exists(plot_dir): if not os.path.exists(plot_dir):
os.mkdir(plot_dir) os.mkdir(plot_dir)
fig.savefig(os.path.join(plot_dir, "var_{}.pdf".format(var_index))) fig.savefig(os.path.join(plot_dir, "var_{}.pdf".format(var_index)))
plt.clf()
def plot_ROC(self): def plot_ROC(self):
logger.info("Plot ROC curve") logger.info("Plot ROC curve")
fpr, tpr, threshold = roc_curve(self.y_test, self.scores_test, sample_weight = self.w_test) 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.grid(color='gray', linestyle='--', linewidth=1)
plt.plot(fpr, tpr, label='NN') 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.xlabel("False positive rate (background rejection)")
plt.ylabel("True positive rate (signal efficiency)") plt.ylabel("True positive rate (signal efficiency)")
plt.title('Receiver operating characteristic') plt.title('Receiver operating characteristic')
......
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