Skip to content
Snippets Groups Projects
Commit 8b1f3c2e authored by Nikolai's avatar Nikolai
Browse files

option to pass bins and range to plot_score and plot_significance

parent 0d931a41
No related branches found
No related tags found
No related merge requests found
......@@ -873,8 +873,7 @@ class ClassificationProject(object):
plt.clf()
def plot_score(self, log=True):
plot_opts = dict(bins=50, range=(0, 1))
def plot_score(self, log=True, plot_opts=dict(bins=50, range=(0, 1))):
centers_sig_train, hist_sig_train, _ = self.get_bin_centered_hist(self.scores_train[self.y_train==1].reshape(-1), density=True, weights=self.w_train[self.y_train==1], **plot_opts)
centers_bkg_train, hist_bkg_train, _ = self.get_bin_centered_hist(self.scores_train[self.y_train==0].reshape(-1), density=True, weights=self.w_train[self.y_train==0], **plot_opts)
centers_sig_test, hist_sig_test, rel_errors_sig_test = self.get_bin_centered_hist(self.scores_test[self.y_test==1].reshape(-1), density=True, weights=self.w_test[self.y_test==1], **plot_opts)
......@@ -894,10 +893,9 @@ class ClassificationProject(object):
fig.savefig(os.path.join(self.project_dir, "scores.pdf"))
def plot_significance(self, lumifactor=1., significanceFunction=None):
def plot_significance(self, lumifactor=1., significanceFunction=None, plot_opts=dict(bins=50, range=(0, 1))):
logger.info("Plot significances")
plot_opts = dict(bins=50, range=(0, 1))
centers_sig_train, hist_sig_train, rel_errors_sig_train = self.get_bin_centered_hist(self.scores_train[self.y_train==1].reshape(-1), weights=self.w_train[self.y_train==1], **plot_opts)
centers_bkg_train, hist_bkg_train, rel_errors_bkg_train = self.get_bin_centered_hist(self.scores_train[self.y_train==0].reshape(-1), weights=self.w_train[self.y_train==0], **plot_opts)
centers_sig_test, hist_sig_test, rel_errors_sig_test = self.get_bin_centered_hist(self.scores_test[self.y_test==1].reshape(-1), weights=self.w_test[self.y_test==1], **plot_opts)
......
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