diff --git a/toolkit.py b/toolkit.py index e801ef6fc3f9d41b6ad42f9dc2eb74eb2d79a4ae..405ad8e5a26f11ee59cc76fbfd6b474e0dab6d9f 100755 --- a/toolkit.py +++ b/toolkit.py @@ -930,7 +930,7 @@ class ClassificationProject(object): plt.clf() - def plot_score(self, log=True, plot_opts=dict(bins=50, range=(0, 1)), ylim=None): + def plot_score(self, log=True, plot_opts=dict(bins=50, range=(0, 1)), ylim=None, xlim=None): 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) @@ -947,6 +947,8 @@ class ClassificationProject(object): ax.set_yscale("log") if ylim is not None: ax.set_ylim(*ylim) + if xlim is not None: + ax.set_xlim(*xlim) ax.set_xlabel("NN output") fig.legend(loc='upper center', framealpha=0.5) fig.savefig(os.path.join(self.project_dir, "scores.pdf"))