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 parameters theta.

  • InformationGeometry.information_from_grid() loads a grid of Fisher Information 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(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(theta0, dtheta0, limits[, ...])

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

information_from_formula(formula, dimension)

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

information_from_grid(theta_grid, ...[, ...])

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

distance_contours(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
theta0ndarray

Parameter point theta0 at which the geodesic trajectory starts.

grid_rangeslist of (tuple of float)

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

grid_resolutionslist 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.

stepsizefloat 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

ntrajectoriesint or None, optional

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

continous_samplingbool, optional

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

return_trajectoriesbool, optional

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

Returns
theta_gridndarray

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

p_valuesndarray

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

p_valuesndarray

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(theta0, dtheta0, limits, stepsize=1)[source]

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

Parameters
theta0ndarray

Parameter point theta0 at which the geodesic trajectory starts.

dtheta0ndarray

Initial direction dtheta0 of the geodesic

limitslist of (tuple of float)

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

stepsizeint, optional

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

Returns
list_of_thetandarray

List of parameter points theta (n_points, n_dimension).

list_of_distancendarray

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

information_from_formula(formula, dimension)[source]

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

Parameters
formulastr

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]])”

dimensionint

Dimensionality of the theory parameter space.

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

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

Parameters
theta_gridndarray

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

fisherinformation_gridndarray

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: DataAnalyzer

Functions to calculate expected Fisher information matrices.

After initializing 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
filenamestr

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

include_nuisance_parametersbool, 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(theta)

Calculates the full Fisher information at parton / truth level.

calculate_fisher_information_hist1d(theta, ...)

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(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.

calculate_fisher_information_nuisance_constraints()

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

calculate_fisher_information_rate(theta, ...)

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

event_loader([start, end, batch_size, ...])

Yields batches of events in the MadMiner file.

full_information(theta, model_file[, ...])

Calculates the full Fisher information in realistic detector-level observations, estimated with neural networks.

histo_information(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(theta, luminosity, ...)

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(theta, ...)

Calculates the full and rate-only Fisher information in slices of one observable.

histogram_of_information(theta, observable, ...)

Calculates the full and rate-only Fisher information in slices of one observable.

histogram_of_sigma_dsigma(theta, observable, ...)

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

nuisance_constraint_information()

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

rate_information(theta, luminosity[, cuts, ...])

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

truth_information(theta[, luminosity, cuts, ...])

Calculates the full Fisher information at parton / truth level.

weighted_events([theta, nu, start_event, ...])

Returns all events together with the benchmark weights (if theta is None) or weights for a given theta.

xsec_gradients(thetas[, nus, partition, ...])

Returns the gradient of total cross sections with respect to parameters.

xsecs([thetas, nus, partition, test_split, ...])

Returns the total cross sections for benchmarks or parameter points.

calculate_fisher_information_full_detector(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
thetandarray

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

model_filestr

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

unweighted_x_sample_filestr 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.

luminosityfloat, optional

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

include_xsec_infobool, 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_covariancebool, optional

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

batch_sizeint, optional

Batch size. Default value: 100000.

test_splitfloat 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_informationndarray 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_uncertaintyndarray 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(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

cutsNone 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_functionslist 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_parametersbool, optional

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

Returns
fisher_informationndarray

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

fisher_information_uncertaintyndarray

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(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

observablestr

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.

binsint or ndarray

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

histrangetuple 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.

cutsNone 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_functionslist 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_binningint 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_informationndarray

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

fisher_information_uncertaintyndarray

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(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

observable1str

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.

bins1int 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).

observable2str

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.

bins2int 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).

histrange1tuple 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.

histrange2tuple 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.

cutsNone 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_functionslist 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_binningint 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_informationndarray

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

fisher_information_uncertaintyndarray

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()

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

calculate_fisher_information_rate(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

cutsNone 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_functionslist 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_parametersbool, optional

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

Returns
fisher_informationndarray

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

fisher_information_uncertaintyndarray

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(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
thetandarray

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

model_filestr

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

unweighted_x_sample_filestr 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.

luminosityfloat, optional

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

include_xsec_infobool, 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_covariancebool, optional

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

batch_sizeint, optional

Batch size. Default value: 100000.

test_splitfloat 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_informationndarray 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_uncertaintyndarray 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(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

observablestr

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.

binsint or ndarray

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

histrangetuple 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.

cutsNone 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_functionslist 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_binningint 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_informationndarray

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

fisher_information_uncertaintyndarray

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(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

observable1str

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.

bins1int 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).

observable2str

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.

bins2int 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).

histrange1tuple 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.

histrange2tuple 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.

cutsNone 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_functionslist 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_binningint 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_informationndarray

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

fisher_information_uncertaintyndarray

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(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
thetandarray

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

observablestr

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.

nbinsint

Number of bins in the slicing, excluding overflow bins.

histrangetuple of float

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

model_filestr 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.

luminosityfloat, optional

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

cutsNone 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_functionslist 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_sizeint, optional

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

test_splitfloat 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_boundariesndarray

Observable slice boundaries.

sigma_binsndarray

Cross section in pb in each of the slices.

fisher_infos_ratendarray

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

fisher_infos_fullndarray

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

histogram_of_information(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
thetandarray

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

observablestr

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.

nbinsint

Number of bins in the slicing, excluding overflow bins.

histrangetuple of float

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

model_filestr 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.

luminosityfloat, optional

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

cutsNone 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_functionslist 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_sizeint, optional

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

test_splitfloat 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_boundariesndarray

Observable slice boundaries.

sigma_binsndarray

Cross section in pb in each of the slices.

fisher_infos_ratendarray

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

fisher_infos_fullndarray

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

histogram_of_sigma_dsigma(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
thetandarray

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

observablestr

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.

nbinsint

Number of bins in the slicing, excluding overflow bins.

histrangetuple of float

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

cutsNone 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_functionslist 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_boundariesndarray

Observable slice boundaries.

sigma_binsndarray

Cross section in pb in each of the slices.

dsigma_binsndarray

Cross section in pb in each of the slices.

nuisance_constraint_information()[source]

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

rate_information(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

cutsNone 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_functionslist 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_parametersbool, optional

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

Returns
fisher_informationndarray

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

fisher_information_uncertaintyndarray

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(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
thetandarray

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

luminosityfloat

Luminosity in pb^-1.

cutsNone 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_functionslist 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_parametersbool, optional

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

Returns
fisher_informationndarray

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

fisher_information_uncertaintyndarray

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_informationndarray

Original n x n Fisher information.

remaining_componentslist of int

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

covariancendarray 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_ensembleint, 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_factorfloat, 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_informationndarray

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_covariancendarray

Covariance matrix of the profiled Fisher 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_informationndarray

Original n x n Fisher information.

remaining_componentslist of int

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

covariancendarray 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_informationndarray

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_covariancendarray

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

Module contents