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

Starting to mess with output scores plotting

parent 1b3e3fc3
No related branches found
No related tags found
No related merge requests found
......@@ -404,7 +404,7 @@ class KerasROOTClassification(object):
try:
self.history = History()
self.shuffle_training_data()
self.model.fit(self.x_train,
# the reshape might be unnescessary here
self.y_train.reshape(-1, 1),
......@@ -541,7 +541,36 @@ class KerasROOTClassification(object):
plt.clf()
def plot_score(self):
pass
logger.info("Plot output scores")
sig_weights = np.empty(sum(self.y_test == 1))
sig_weights.fill(self.class_weight[1])
bkg_weights = np.empty(sum(self.y_test == 0))
bkg_weights.fill(self.class_weight[0])
print sig_weights.reshape(-1,1).shape
print self.scores_test[self.y_test==1].shape
binning = [20,0,1]
fig = plt.figure(figsize=(8,6))
ax1 = plt.subplot2grid((4,4), (0,0), colspan=4, rowspan=4)
ax1.tick_params(direction='in')
ax1.set_xlim((binning[1], binning[2]))
ax1.xaxis.set_ticks_position('both')
ax1.yaxis.set_ticks_position('both')
s_histTest, s_binsTest, s_patchesTest = plt.hist(self.scores_test[self.y_test==1],weights=sig_weights.reshape(-1,1), histtype='stepfilled', color='r', label='Signal (Training)', alpha=0.5, bins=binning[0], range=(binning[1], binning[2]))
b_histTest, b_binsTest, b_patchesTest = plt.hist(self.scores_test[self.y_test==0],weights=bkg_weights.reshape(-1,1), histtype='stepfilled', color='b', label='Background (Training)', alpha=0.5, bins=binning[0], range=(binning[1], binning[2]))
plt.xlabel('Output score')
plt.ylabel('a.u.')
plt.legend(loc='upper right', framealpha=1.0)
plt.savefig(os.path.join(self.project_dir, "scores.pdf"))
plt.clf()
def plot_loss(self):
......
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