Skip to content

Commit

Permalink
Merge pull request #344 from johannbrehmer/develop
Browse files Browse the repository at this point in the history
Fixed normaliization in histogram_of_fisher_information()
  • Loading branch information
johannbrehmer authored Jun 5, 2019
2 parents 4c8ffd0 + dbaee9b commit a9985b3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions madminer/fisherinformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,12 +890,21 @@ def histogram_of_fisher_information(
self.n_nuisance_parameters,
)

# Total xsec
total_xsec = self._calculate_xsec(theta=theta)
logger.debug("Total cross section: %s pb", total_xsec)

# Which events to sum over
if test_split is None or test_split <= 0.0 or test_split >= 1.0:
start_event = 0
else:
start_event = int(round((1.0 - test_split) * self.n_samples, 0)) + 1

if start_event > 0:
total_sum_weights_theta = self._calculate_xsec(theta=theta, start_event=start_event)
else:
total_sum_weights_theta = total_xsec

# Number of batches
n_batches = int(np.ceil((self.n_samples - start_event) / batch_size))
n_batches_verbose = max(int(round(n_batches / 10, 0)), 1)
Expand Down Expand Up @@ -929,7 +938,7 @@ def histogram_of_fisher_information(
fisher_info_events, _ = model.calculate_fisher_information(
x=observations,
obs_weights=weights_theta,
n_events=luminosity * np.sum(weights_theta),
n_events=luminosity * np.sum(weights_theta) * total_xsec / total_sum_weights_theta,
mode="score",
calculate_covariance=False,
sum_events=False,
Expand All @@ -938,7 +947,7 @@ def histogram_of_fisher_information(
fisher_info_events = model.calculate_fisher_information(
x=observations,
weights=weights_theta,
n_events=luminosity * np.sum(weights_theta),
n_events=luminosity * np.sum(weights_theta) * total_xsec / total_sum_weights_theta,
sum_events=False,
)

Expand Down

0 comments on commit a9985b3

Please sign in to comment.