madminer.fisherinformation package

Submodules

madminer.fisherinformation.geometry module

class madminer.fisherinformation.geometry.InformationGeometry[source]

Bases: object

Functions to calculate limits using Information Geometry.

After initializing the InformationGeometry class, a Fisher Information needs to be provided using one of the following functions

  • InformationGeometry.information_from_formula() defines the Fisher Information

explicitly as function of the theory paramters theta. * InformationGeometry.information_from_grid() loads a grid of Fisher Informations which is then interpolated.

Using information geometrical methods, the function InformationGeometry.distance_contours() then calculates the distance contours and equivalently the p-values throughout parameter space.

Methods

distance_contours(self, theta0, grid_ranges, …) Finds the distance values from the point theta0 and the corresponding p-value within the parameter space bounded by grid_ranges.
find_trajectory(self, theta0, dtheta0, limits) Finds the geodesic trajectory starting at a parameter point theta0 going in the initial direction dtheta0.
information_from_formula(self, formula, …) Explicitly defines the Fisher Information as function of the theory parameter theta through a formula that can be avaulated using eval().
information_from_grid(self, theta_grid, …) Loads a grid of coordinates and corresponding Fisher Information, which is then interpolated.
distance_contours(self, theta0, grid_ranges, grid_resolutions, stepsize=None, ntrajectories=None, continous_sampling=False, return_trajectories=False)[source]

Finds the distance values from the point theta0 and the corresponding p-value within the parameter space bounded by grid_ranges.

Parameters:
theta0 : ndarray

Parameter point theta0 at which the geodesic trajectory starts.

grid_ranges : list of (tuple of float)

Specifies the boundaries of the parameter grid in which the trajectory is evaulated. It should be [[min, max], [min, max], …, [min, max], where the list goes over all parameters and min and max are float.

grid_resolutions : list of int

Resolution of the parameter space grid on which the p-values are evaluated. The individual entries specify the number of points along each parameter individually.

stepsize : float or None, optional

Maximal stepsize |Delta theta| during numerical integration in parameter space. If None, stepsize = min([(max-min)/20 for (min,max) in grid_ranges]). Default: None

ntrajectories : int or None, optional

Number of sampled trajectories. If None, ntrajectories = 20 times the number of dimensions. Default: None

continous_sampling : bool, optional

If n_dimension is 2, the trajectories are sampled continously in the angular direction. Default: False

return_trajectories : bool, optional

Returns the trajectories (parameter points and distances). Default: False

Returns:
theta_grid : ndarray

Parameter points at which the p-values are evaluated with shape (n_grid_points, n_dimension).

p_values : ndarray

Observed p-values for each parameter point on the grid, with shape (n_grid_points,).

p_values : ndarray

Interpolated distance from theta0 for each parameter point on the grid, with shape (n_grid_points,).

(list_of_theta, list_of_distance) : (ndarray,ndarray)

Only returned if return_trajectories is True. List of parameter points theta (n_points, n_dimension) and List of distances from the staring point theta0 (n_points, ).

find_trajectory(self, theta0, dtheta0, limits, stepsize=1)[source]

Finds the geodesic trajectory starting at a parameter point theta0 going in the initial direction dtheta0.

Parameters:
theta0 : ndarray

Parameter point theta0 at which the geodesic trajectory starts.

dtheta0 : ndarray

Initial direction dtheta0 of the geodesic

limits : list of (tuple of float)

Specifies the boundaries of the parameter grid in which the trajectory is evaulated. It should be [[min, max], [min, max], …, [min, max], where the list goes over all parameters and min and max are float.

stepsize : int, optional

Maximal stepsize |Delta theta| during numerical integration in parameter space. $Default: 1

Returns:
list_of_theta : ndarray

List of parameter points theta (n_points, n_dimension).

list_of_distance : ndarray

List of distances from the staring point theta0 (n_points, ).

information_from_formula(self, formula, dimension)[source]

Explicitly defines the Fisher Information as function of the theory parameter theta through a formula that can be avaulated using eval().

Parameters:
formula : str

Explicit definition of the Fisher Information as ndarray, which can be a function of the n-dimensional theory parameter theta. Example: formula=”np.array([[1+theta[0],1],[1,2*theta[1]**2]])”

dimension : int

Dimensionality of the theory parameter space.

information_from_grid(self, theta_grid, fisherinformation_grid, option='smooth', inverse='exact')[source]

Loads a grid of coordinates and corresponding Fisher Information, which is then interpolated.

Parameters:
theta_grid : ndarray

List if parameter points theta at which the Fisher information matrices I_ij(theta) is evaluated. Shape (n_gridpoints, n_dimension).

fisherinformation_grid : ndarray

List if Fisher information matrices I_ij(theta). Shape (n_gridpoints, n_dimension, n_dimension).

option : {“smooth”, “linear”}

Defines if the Fisher Information is interpolated smoothly using the function CloughTocher2DInterpolator() or piecewise linear using LinearNDInterpolator(). Default = ‘smooth’.

inverse : {“exact”, “interpolate”}

Defines if the inverse Fisher Information is obtained by either first interpolating the Fisher Information and then inverting it (“exact”) or by first inverting the grid of Fisher Informations and then interpolating the inverse (“interpolate”). Default = ‘exact’.

madminer.fisherinformation.information module

class madminer.fisherinformation.information.FisherInformation(filename, include_nuisance_parameters=True)[source]

Bases: madminer.analysis.dataanalyzer.DataAnalyzer

Functions to calculate expected Fisher information matrices.

After inializing a FisherInformation instance with the filename of a MadMiner file, different information matrices can be calculated:

  • FisherInformation.truth_information() calculates the full truth-level Fisher information. This is the information in an idealized measurement where all parton-level particles with their charges, flavours, and four-momenta can be accessed with perfect accuracy.
  • FisherInformation.full_information() calculates the full Fisher information in realistic detector-level observations, estimated with neural networks. In addition to the MadMiner file, this requires a trained SALLY or SALLINO estimator as well as an unweighted evaluation sample.
  • FisherInformation.rate_information() calculates the Fisher information in the total cross section.
  • FisherInformation.histo_information() calculates the Fisher information in the histogram of one (parton-level or detector-level) observable.
  • FisherInformation.histo_information_2d() calculates the Fisher information in a two-dimensional histogram of two (parton-level or detector-level) observables.
  • FisherInformation.histogram_of_information() calculates the full truth-level Fisher information in different slices of one observable (the “distribution of the Fisher information”).

Finally, don’t forget that in the presence of nuisance parameters the constraint terms also affect the Fisher information. This term is given by FisherInformation.calculate_fisher_information_nuisance_constraints().

Parameters:
filename : str

Path to MadMiner file (for instance the output of madminer.delphes.DelphesProcessor.save()).

include_nuisance_parameters : bool, optional

If True, nuisance parameters are taken into account. Default value: True.

Methods

calculate_fisher_information_full_detector(…) Calculates the full Fisher information in realistic detector-level observations, estimated with neural networks.
calculate_fisher_information_full_truth(…) Calculates the full Fisher information at parton / truth level.
calculate_fisher_information_hist1d(self, …) Calculates the Fisher information in the one-dimensional histogram of an (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observable.
calculate_fisher_information_hist2d(self, …) Calculates the Fisher information in a two-dimensional histogram of two (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observables.
calculate_fisher_information_nuisance_constraints(self) Builds the Fisher information term representing the Gaussian constraints on the nuisance parameters
calculate_fisher_information_rate(self, …) Calculates the Fisher information in a measurement of the total cross section (without any kinematic information).
event_loader(self[, start, end, batch_size, …]) Yields batches of events in the MadMiner file.
full_information(self, theta, model_file[, …]) Calculates the full Fisher information in realistic detector-level observations, estimated with neural networks.
histo_information(self, theta, luminosity, …) Calculates the Fisher information in the one-dimensional histogram of an (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observable.
histo_information_2d(self, theta, …[, …]) Calculates the Fisher information in a two-dimensional histogram of two (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observables.
histogram_of_fisher_information(self, theta, …) Calculates the full and rate-only Fisher information in slices of one observable.
histogram_of_information(self, theta, …[, …]) Calculates the full and rate-only Fisher information in slices of one observable.
histogram_of_sigma_dsigma(self, theta, …) Fills events into histograms and calculates the cross section and first derivative for each bin
nuisance_constraint_information(self) Builds the Fisher information term representing the Gaussian constraints on the nuisance parameters
rate_information(self, theta, luminosity[, …]) Calculates the Fisher information in a measurement of the total cross section (without any kinematic information).
truth_information(self, theta[, luminosity, …]) Calculates the full Fisher information at parton / truth level.
weighted_events(self[, theta, nu, …]) Returns all events together with the benchmark weights (if theta is None) or weights for a given theta.
xsec_gradients(self, thetas[, nus, …]) Returns the gradient of total cross sections with respect to parameters.
xsecs(self[, thetas, nus, partition, …]) Returns the total cross sections for benchmarks or parameter points.
calculate_fisher_information_full_detector(self, theta, model_file, unweighted_x_sample_file=None, luminosity=300000.0, include_xsec_info=True, mode='score', calculate_covariance=True, batch_size=100000, test_split=0.2)

Calculates the full Fisher information in realistic detector-level observations, estimated with neural networks. In addition to the MadMiner file, this requires a trained SALLY or SALLINO estimator.

Nuisance parameter are taken into account automatically if the SALLY / SALLINO model was trained with them.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

model_file : str

Filename of a trained local score regression model that was trained on samples from theta (see madminer.ml.Estimator).

unweighted_x_sample_file : str or None

Filename of an unweighted x sample that is sampled according to theta and obeys the cuts (see madminer.sampling.SampleAugmenter.extract_samples_train_local()). If None, the Fisher information is instead calculated on the full, weighted samples (the data in the MadMiner file). Default value: None.

luminosity : float, optional

Luminosity in pb^-1. Default value: 300000.

include_xsec_info : bool, optional

Whether the rate information is included in the returned Fisher information. Default value: True.

mode : {“score”, “information”}, optional

How the ensemble uncertainty on the kinematic Fisher information is calculated. If mode is “information”, the Fisher information for each estimator is calculated individually and only then are the sample mean and covariance calculated. If mode is “score”, the sample mean is calculated for the score for each event. Default value: “score”.

calculate_covariance : bool, optional

If True, the covariance between the different estimators is calculated. Default value: True.

batch_size : int, optional

Batch size. Default value: 100000.

test_split : float or None, optional

If unweighted_x_sample_file is None, this determines the fraction of weighted events used for evaluation. If None, all events are used (this will probably include events used during training!). Default value: 0.2.

Returns:
fisher_information : ndarray or list of ndarray

Estimated expected full detector-level Fisher information matrix with shape (n_parameters, n_parameters). If more then one value ensemble_vote_expectation_weight is given, this is a list with results for all entries in ensemble_vote_expectation_weight.

fisher_information_uncertainty : ndarray or list of ndarray or None

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters). If more then one value ensemble_vote_expectation_weight is given, this is a list with results for all entries in ensemble_vote_expectation_weight.

calculate_fisher_information_full_truth(self, theta, luminosity=300000.0, cuts=None, efficiency_functions=None, include_nuisance_parameters=True)

Calculates the full Fisher information at parton / truth level. This is the information in an idealized measurement where all parton-level particles with their charges, flavours, and four-momenta can be accessed with perfect accuracy, i.e. the latent variables z_parton can be measured directly.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

include_nuisance_parameters : bool, optional

If True, nuisance parameters are taken into account. Default value: True.

Returns:
fisher_information : ndarray

Expected full truth-level Fisher information matrix with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

calculate_fisher_information_hist1d(self, theta, luminosity, observable, bins, histrange=None, cuts=None, efficiency_functions=None, n_events_dynamic_binning=None)

Calculates the Fisher information in the one-dimensional histogram of an (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observable.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

observable : str

Expression for the observable to be histogrammed. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

bins : int or ndarray

If int: number of bins in the histogram, excluding overflow bins. Otherwise, defines the bin boundaries (excluding overflow bins).

histrange : tuple of float or None, optional

Minimum and maximum value of the histogram in the form (min, max). Overflow bins are always added. If None and bins is an int, variable-width bins with equal cross section are constructed automatically. Default value: None.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

n_events_dynamic_binning : int or None, optional

Number of events used to calculate the dynamic binning (if histrange is None). If None, all events are used. Note that these events are not shuffled, so if the events in the MadMiner file are sorted, using a value different from None can cause issues. Default value: None.

Returns:
fisher_information : ndarray

Expected Fisher information in the histogram with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

calculate_fisher_information_hist2d(self, theta, luminosity, observable1, bins1, observable2, bins2, histrange1=None, histrange2=None, cuts=None, efficiency_functions=None, n_events_dynamic_binning=None)

Calculates the Fisher information in a two-dimensional histogram of two (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observables.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

observable1 : str

Expression for the first observable to be histogrammed. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

bins1 : int or ndarray

If int: number of bins along the first axis in the histogram in the histogram, excluding overflow bins. Otherwise, defines the bin boundaries along the first axis in the histogram (excluding overflow bins).

observable2 : str

Expression for the first observable to be histogrammed. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

bins2 : int or ndarray

If int: number of bins along the second axis in the histogram in the histogram, excluding overflow bins. Otherwise, defines the bin boundaries along the second axis in the histogram (excluding overflow bins).

histrange1 : tuple of float or None, optional

Minimum and maximum value of the first axis of the histogram in the form (min, max). Overflow bins are always added. If None, variable-width bins with equal cross section are constructed automatically. Default value: None.

histrange2 : tuple of float or None, optional

Minimum and maximum value of the first axis of the histogram in the form (min, max). Overflow bins are always added. If None, variable-width bins with equal cross section are constructed automatically. Default value: None.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

n_events_dynamic_binning : int or None, optional

Number of events used to calculate the dynamic binning (if histrange is None). If None, all events are used. Note that these events are not shuffled, so if the events in the MadMiner file are sorted, using a value different from None can cause issues. Default value: None.

Returns:
fisher_information : ndarray

Expected Fisher information in the histogram with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

calculate_fisher_information_nuisance_constraints(self)

Builds the Fisher information term representing the Gaussian constraints on the nuisance parameters

calculate_fisher_information_rate(self, theta, luminosity, cuts=None, efficiency_functions=None, include_nuisance_parameters=True)

Calculates the Fisher information in a measurement of the total cross section (without any kinematic information).

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

include_nuisance_parameters : bool, optional

If True, nuisance parameters are taken into account. Default value: True.

Returns:
fisher_information : ndarray

Expected Fisher information in the total cross section with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

full_information(self, theta, model_file, unweighted_x_sample_file=None, luminosity=300000.0, include_xsec_info=True, mode='score', calculate_covariance=True, batch_size=100000, test_split=0.2)[source]

Calculates the full Fisher information in realistic detector-level observations, estimated with neural networks. In addition to the MadMiner file, this requires a trained SALLY or SALLINO estimator.

Nuisance parameter are taken into account automatically if the SALLY / SALLINO model was trained with them.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

model_file : str

Filename of a trained local score regression model that was trained on samples from theta (see madminer.ml.Estimator).

unweighted_x_sample_file : str or None

Filename of an unweighted x sample that is sampled according to theta and obeys the cuts (see madminer.sampling.SampleAugmenter.extract_samples_train_local()). If None, the Fisher information is instead calculated on the full, weighted samples (the data in the MadMiner file). Default value: None.

luminosity : float, optional

Luminosity in pb^-1. Default value: 300000.

include_xsec_info : bool, optional

Whether the rate information is included in the returned Fisher information. Default value: True.

mode : {“score”, “information”}, optional

How the ensemble uncertainty on the kinematic Fisher information is calculated. If mode is “information”, the Fisher information for each estimator is calculated individually and only then are the sample mean and covariance calculated. If mode is “score”, the sample mean is calculated for the score for each event. Default value: “score”.

calculate_covariance : bool, optional

If True, the covariance between the different estimators is calculated. Default value: True.

batch_size : int, optional

Batch size. Default value: 100000.

test_split : float or None, optional

If unweighted_x_sample_file is None, this determines the fraction of weighted events used for evaluation. If None, all events are used (this will probably include events used during training!). Default value: 0.2.

Returns:
fisher_information : ndarray or list of ndarray

Estimated expected full detector-level Fisher information matrix with shape (n_parameters, n_parameters). If more then one value ensemble_vote_expectation_weight is given, this is a list with results for all entries in ensemble_vote_expectation_weight.

fisher_information_uncertainty : ndarray or list of ndarray or None

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters). If more then one value ensemble_vote_expectation_weight is given, this is a list with results for all entries in ensemble_vote_expectation_weight.

histo_information(self, theta, luminosity, observable, bins, histrange=None, cuts=None, efficiency_functions=None, n_events_dynamic_binning=None)[source]

Calculates the Fisher information in the one-dimensional histogram of an (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observable.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

observable : str

Expression for the observable to be histogrammed. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

bins : int or ndarray

If int: number of bins in the histogram, excluding overflow bins. Otherwise, defines the bin boundaries (excluding overflow bins).

histrange : tuple of float or None, optional

Minimum and maximum value of the histogram in the form (min, max). Overflow bins are always added. If None and bins is an int, variable-width bins with equal cross section are constructed automatically. Default value: None.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

n_events_dynamic_binning : int or None, optional

Number of events used to calculate the dynamic binning (if histrange is None). If None, all events are used. Note that these events are not shuffled, so if the events in the MadMiner file are sorted, using a value different from None can cause issues. Default value: None.

Returns:
fisher_information : ndarray

Expected Fisher information in the histogram with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

histo_information_2d(self, theta, luminosity, observable1, bins1, observable2, bins2, histrange1=None, histrange2=None, cuts=None, efficiency_functions=None, n_events_dynamic_binning=None)[source]

Calculates the Fisher information in a two-dimensional histogram of two (parton-level or detector-level, depending on how the observations in the MadMiner file were calculated) observables.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

observable1 : str

Expression for the first observable to be histogrammed. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

bins1 : int or ndarray

If int: number of bins along the first axis in the histogram in the histogram, excluding overflow bins. Otherwise, defines the bin boundaries along the first axis in the histogram (excluding overflow bins).

observable2 : str

Expression for the first observable to be histogrammed. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

bins2 : int or ndarray

If int: number of bins along the second axis in the histogram in the histogram, excluding overflow bins. Otherwise, defines the bin boundaries along the second axis in the histogram (excluding overflow bins).

histrange1 : tuple of float or None, optional

Minimum and maximum value of the first axis of the histogram in the form (min, max). Overflow bins are always added. If None, variable-width bins with equal cross section are constructed automatically. Default value: None.

histrange2 : tuple of float or None, optional

Minimum and maximum value of the first axis of the histogram in the form (min, max). Overflow bins are always added. If None, variable-width bins with equal cross section are constructed automatically. Default value: None.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

n_events_dynamic_binning : int or None, optional

Number of events used to calculate the dynamic binning (if histrange is None). If None, all events are used. Note that these events are not shuffled, so if the events in the MadMiner file are sorted, using a value different from None can cause issues. Default value: None.

Returns:
fisher_information : ndarray

Expected Fisher information in the histogram with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

histogram_of_fisher_information(self, theta, observable, nbins, histrange, model_file=None, luminosity=300000.0, cuts=None, efficiency_functions=None, batch_size=100000, test_split=0.2)

Calculates the full and rate-only Fisher information in slices of one observable. For the full information, it will return the truth-level information if model_file is None, and otherwise the detector-level information based on the SALLY-type score estimator saved in model_file.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

observable : str

Expression for the observable to be sliced. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

nbins : int

Number of bins in the slicing, excluding overflow bins.

histrange : tuple of float

Minimum and maximum value of the slicing in the form (min, max). Overflow bins are always added.

model_file : str or None, optional

If None, the truth-level Fisher information is calculated. If str, filename of a trained local score regression model that was trained on samples from theta (see madminer.ml.Estimator). Default value: None.

luminosity : float, optional

Luminosity in pb^-1. Default value: 300000.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

batch_size : int, optional

If model_file is not None: Batch size. Default value: 100000.

test_split : float or None, optional

If model_file is not None: If unweighted_x_sample_file is None, this determines the fraction of weighted events used for evaluation. If None, all events are used (this will probably include events used during training!). Default value: 0.2.

Returns:
bin_boundaries : ndarray

Observable slice boundaries.

sigma_bins : ndarray

Cross section in pb in each of the slices.

fisher_infos_rate : ndarray

Expected rate-only Fisher information for each slice. Has shape (n_slices, n_parameters, n_parameters).

fisher_infos_full : ndarray

Expected full Fisher information for each slice. Has shape (n_slices, n_parameters, n_parameters).

histogram_of_information(self, theta, observable, nbins, histrange, model_file=None, luminosity=300000.0, cuts=None, efficiency_functions=None, batch_size=100000, test_split=0.2)[source]

Calculates the full and rate-only Fisher information in slices of one observable. For the full information, it will return the truth-level information if model_file is None, and otherwise the detector-level information based on the SALLY-type score estimator saved in model_file.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

observable : str

Expression for the observable to be sliced. The str will be parsed by Python’s eval() function and can use the names of the observables in the MadMiner files.

nbins : int

Number of bins in the slicing, excluding overflow bins.

histrange : tuple of float

Minimum and maximum value of the slicing in the form (min, max). Overflow bins are always added.

model_file : str or None, optional

If None, the truth-level Fisher information is calculated. If str, filename of a trained local score regression model that was trained on samples from theta (see madminer.ml.Estimator). Default value: None.

luminosity : float, optional

Luminosity in pb^-1. Default value: 300000.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

batch_size : int, optional

If model_file is not None: Batch size. Default value: 100000.

test_split : float or None, optional

If model_file is not None: If unweighted_x_sample_file is None, this determines the fraction of weighted events used for evaluation. If None, all events are used (this will probably include events used during training!). Default value: 0.2.

Returns:
bin_boundaries : ndarray

Observable slice boundaries.

sigma_bins : ndarray

Cross section in pb in each of the slices.

fisher_infos_rate : ndarray

Expected rate-only Fisher information for each slice. Has shape (n_slices, n_parameters, n_parameters).

fisher_infos_full : ndarray

Expected full Fisher information for each slice. Has shape (n_slices, n_parameters, n_parameters).

histogram_of_sigma_dsigma(self, theta, observable, nbins, histrange, cuts=None, efficiency_functions=None)[source]

Fills events into histograms and calculates the cross section and first derivative for each bin

Parameters:
theta : ndarray
Parameter point `theta` at which the Fisher information matrix `I_ij(theta)` is evaluated.
observable : str
Expression for the observable to be sliced. The str will be parsed by Python’s `eval()` function
and can use the names of the observables in the MadMiner files.
nbins : int
Number of bins in the slicing, excluding overflow bins.
histrange : tuple of float
Minimum and maximum value of the slicing in the form `(min, max)`. Overflow bins are always added.
cuts : None or list of str, optional
Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut,
False otherwise). Default value: None.
efficiency_functions : list of str or None
Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one
component. Default value: None.
Returns:
bin_boundaries : ndarray
Observable slice boundaries.
sigma_bins : ndarray
Cross section in pb in each of the slices.
dsigma_bins : ndarray
Cross section in pb in each of the slices.
nuisance_constraint_information(self)[source]

Builds the Fisher information term representing the Gaussian constraints on the nuisance parameters

rate_information(self, theta, luminosity, cuts=None, efficiency_functions=None, include_nuisance_parameters=True)[source]

Calculates the Fisher information in a measurement of the total cross section (without any kinematic information).

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

include_nuisance_parameters : bool, optional

If True, nuisance parameters are taken into account. Default value: True.

Returns:
fisher_information : ndarray

Expected Fisher information in the total cross section with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

truth_information(self, theta, luminosity=300000.0, cuts=None, efficiency_functions=None, include_nuisance_parameters=True)[source]

Calculates the full Fisher information at parton / truth level. This is the information in an idealized measurement where all parton-level particles with their charges, flavours, and four-momenta can be accessed with perfect accuracy, i.e. the latent variables z_parton can be measured directly.

Parameters:
theta : ndarray

Parameter point theta at which the Fisher information matrix I_ij(theta) is evaluated.

luminosity : float

Luminosity in pb^-1.

cuts : None or list of str, optional

Cuts. Each entry is a parseable Python expression that returns a bool (True if the event should pass a cut, False otherwise). Default value: None.

efficiency_functions : list of str or None

Efficiencies. Each entry is a parseable Python expression that returns a float for the efficiency of one component. Default value: None.

include_nuisance_parameters : bool, optional

If True, nuisance parameters are taken into account. Default value: True.

Returns:
fisher_information : ndarray

Expected full truth-level Fisher information matrix with shape (n_parameters, n_parameters).

fisher_information_uncertainty : ndarray

Covariance matrix of the Fisher information matrix with shape (n_parameters, n_parameters, n_parameters, n_parameters), calculated with plain Gaussian error propagation.

madminer.fisherinformation.manipulate module

madminer.fisherinformation.manipulate.profile_information(fisher_information, remaining_components, covariance=None, error_propagation_n_ensemble=1000, error_propagation_factor=0.001)[source]

Calculates the profiled Fisher information matrix as defined in Appendix A.4 of arXiv:1612.05261.

Parameters:
fisher_information : ndarray

Original n x n Fisher information.

remaining_components : list of int

List with m entries, each an int with 0 <= remaining_compoinents[i] < n. Denotes which parameters are kept, and their new order. All other parameters or profiled out.

covariance : ndarray or None, optional

The covariance matrix of the original Fisher information with shape (n, n, n, n). If None, the error on the profiled information is not calculated. Default value: None.

error_propagation_n_ensemble : int, optional

If covariance is not None, this sets the number of Fisher information matrices drawn from a normal distribution for the Monte-Carlo error propagation. Default value: 1000.

error_propagation_factor : float, optional

If covariance is not None, this factor multiplies the covariance of the distribution of Fisher information matrices. Smaller factors can avoid problems with ill-behaved Fisher information matrices. Default value: 1.e-3.

Returns:
profiled_fisher_information : ndarray

Profiled m x m Fisher information, where the i-th row or column corresponds to the remaining_components[i]-th row or column of fisher_information.

profiled_fisher_information_covariance : ndarray

Covariance matrix of the profiled Fishere information matrix with shape (m, m, m, m).

madminer.fisherinformation.manipulate.project_information(fisher_information, remaining_components, covariance=None)[source]

Calculates projections of a Fisher information matrix, that is, “deletes” the rows and columns corresponding to some parameters not of interest.

Parameters:
fisher_information : ndarray

Original n x n Fisher information.

remaining_components : list of int

List with m entries, each an int with 0 <= remaining_compoinents[i] < n. Denotes which parameters are kept, and their new order. All other parameters or projected out.

covariance : ndarray or None, optional

The covariance matrix of the original Fisher information with shape (n, n, n, n). If None, the error on the profiled information is not calculated. Default value: None.

Returns:
projected_fisher_information : ndarray

Projected m x m Fisher information, where the i-th row or column corresponds to the remaining_components[i]-th row or column of fisher_information.

profiled_fisher_information_covariance : ndarray

Covariance matrix of the projected Fisher information matrix with shape (m, m, m, m). Only returned if covariance is not None.

Module contents