diff --git a/src/loaders/prec_inn.py b/src/loaders/prec_inn.py index 310f83f..af15d09 100644 --- a/src/loaders/prec_inn.py +++ b/src/loaders/prec_inn.py @@ -139,7 +139,7 @@ def compute_preprocessing( input_obs.append(mass) if append_delta_r: - drinv = lambda x: x #np.minimum(1/(x+1e-7), 20) + drinv = lambda x: np.minimum(1/(x+1e-7), 20) if mult > 3: input_obs.append(drinv(dr(obs.phi[:,2], obs.phi[:,3], obs.eta[:,2], obs.eta[:,3]))) if mult > 4: diff --git a/src/plots.py b/src/plots.py index 8e27a50..4d144f5 100644 --- a/src/plots.py +++ b/src/plots.py @@ -137,7 +137,7 @@ def plot_roc(self, file: str): Args: file: Output file name """ - scores = -np.concatenate((1/self.weights_true, self.weights_fake), axis=0) + scores = -np.concatenate((self.weights_true, self.weights_fake), axis=0) labels = np.concatenate(( np.ones_like(self.weights_true), np.zeros_like(self.weights_fake) @@ -231,20 +231,17 @@ def plot_single_weight_hist( if self.bayesian: true_hists = np.stack([ np.histogram( - self.weights_true[:,i] / np.mean(self.weights_true[:,i]), - bins=bins + self.weights_true[:,i], bins=bins )[0] for i in range(self.weights_true.shape[1]) ], axis=1) fake_hists = np.stack([ np.histogram( - self.weights_fake[:,i] / np.mean(self.weights_fake[:,i]), - bins=bins + self.weights_fake[:,i], bins=bins )[0] for i in range(self.weights_fake.shape[1]) ], axis=1) combined_hists = np.stack([ np.histogram( - weights_combined[:,i] / np.mean(weights_combined[:,i]), - bins=bins + weights_combined[:,i], bins=bins )[0] for i in range(weights_combined.shape[1]) ], axis=1) @@ -263,14 +260,6 @@ def plot_single_weight_hist( np.quantile(combined_hists, 0.159, axis=1), np.quantile(combined_hists, 0.841, axis=1) ), axis=0) - - #y_true = np.mean(true_hists, axis=1) - #y_true_err = np.std(true_hists, axis=1) - #y_fake = np.mean(fake_hists, axis=1) - #y_fake_err = np.std(fake_hists, axis=1) - #y_combined = np.mean(combined_hists, axis=1) - #y_combined_err = np.std(combined_hists, axis=1) - else: y_true = np.histogram(self.weights_true, bins=bins)[0] y_true_err = None diff --git a/src/train.py b/src/train.py index c084ee1..a16aecb 100644 --- a/src/train.py +++ b/src/train.py @@ -286,7 +286,7 @@ def predict_single(self): ]) y_true_sig = y_true.sigmoid().flatten() y_fake_sig = y_fake.sigmoid().flatten() - w_true = (1 - y_true_sig) / y_true_sig + w_true = y_true_sig / (1 - y_true_sig) w_fake = y_fake_sig / (1 - y_fake_sig) min_size = min(len(y_true), len(y_fake)) clf_score = self.loss(