JeffreysPrior

class remu.likelihood.JeffreysPrior(response_matrix, translation_function, parameter_limits, default_values, dx=None, total_truth_limit=None)[source]

Universal non-informative prior for use in Bayesian MCMC analysis.

Parameters
response_matrixndarray

Response matrix that translates truth into reco bins. Can be an array of matrices.

translation_functionfunction

The function to translate a vector of parameters into a vector of truth expectation values:

truth_vector = translation_function(parameter_vector)

It must support translating arrays of parameter vectors into arrays of truth vectors:

[truth_vector, ...] = translation_function([parameter_vector, ...])
parameter_limitsiterable of tuple of floats

An iterable of lower and upper limits of the hypothesis’ parameters. The number of limits determines the number of parameters. Parameters can be None. This sets no limit in that direction.

[ (x1_min, x1_max), (x2_min, x2_max), ... ]
default_valuesiterable of floats

The default values of the parameters

dxarray like

Array of step sizes to be used in numerical differentiation. Default: numpy.full(len(parameter_limits), 1e-3)

total_truth_limitfloat

Maximum total number of truth events to consider in the prior. This can be used to make priors proper in a consistent way, since the limit is defined in the truth space, rather than the prior parameter space.

Notes

The JeffreysPrior object can be called like a function. It will return the prior log-likliehood of the given set of parameters:

prior_likelihood = jeffreys_prior(parameter_vector)

If the prior was constructed with more than one response matrix, the matrix to be used for the calculation can be chosen with the toy_index argument:

jeffreys_prior(parameter_vector, toy_index=5)

By construction, the JeffreysPrior will return the log probability -inf, a probability of 0, when the expected reco values do not depend on one of the parameters. In this case the “useless” parameter should be removed. It simply cannot be constrained with the given detector response.

Attributes

response_matrix

(ndarray) The response matrix used to calculate the Fisher matrix.

default_values

(ndarray) The default values of the parameters.

lower_limits

(ndarray) Lower limits of the parameters.

upper_limits

(ndarray) Upper limits of the parameters.

total_truth_limit

(float) The upper limit of total number of true events.

dx

(ndarray) Array of step sizes to be used in numerical differentiation.

Methods

__call__(value[, toy_index])

Calculate the prior probability of the given parameter set.

fisher_matrix(parameters[, toy_index])

Calculate the Fisher information matrix for the given parameters.

translate(parameters)

Translate the parameter vector to a truth vector.

fisher_matrix(parameters, toy_index=0)[source]

Calculate the Fisher information matrix for the given parameters.

Parameters
parametersarray like

The parameters of the translation function.

toy_indexint, optional

The index of the response matrix to be used for the calculation

Returns
ndarray

The Fisher information matrix.

translate(parameters)[source]

Translate the parameter vector to a truth vector.

Parameters
parametersndarray like

Vector of the hypothesis parameters.

Returns
ndarray

Vector of the corresponding truth space expectation values.