Predictor

class remu.likelihood.Predictor(bounds, defaults)[source]

Base class for objects that turn sets of parameters to predictions.

Parameters
boundsndarray

Lower and upper bounds for all parameters. Can be +/- np.inf.

defaultsndarray

“Reasonable” default values for the parameters. Used in optimisations.

Attributes

bounds

(ndarray) Lower and upper bounds for all parameters. Can be +/- np.inf.

defaults

(ndarray) “Reasonable” default values for the parameters. Used in optimisations.

Methods

__call__(*args, **kwargs)

See prediction().

check_bounds(parameters)

Check that all parameters are within bounds.

compose(other)

Return a new Predictor that is a composition with other.

fix_parameters(fix_values)

Return a new Predictor with fewer free parameters.

prediction(parameters[, systematics_index])

Turn a set of parameters into an ndarray of reco predictions.

check_bounds(parameters)[source]

Check that all parameters are within bounds.

compose(other)[source]

Return a new Predictor that is a composition with other.

new_predictor(parameters) = self(other(parameters))
fix_parameters(fix_values)[source]

Return a new Predictor with fewer free parameters.

Parameters
fix_valuesiterable

List of the parameter values that the parameters should be fixed at. The list must be of the same length as the number of parameters of predictor. Any parameters that should remain unfixed should be specified with None or np.nan.

prediction(parameters, systematics_index=slice(None, None, None))[source]

Turn a set of parameters into an ndarray of reco predictions.

Parameters
parametersndarray
systematics_indexint, optional
Returns
prediction, weightsndarray

Notes

The regular output must have at least two dimensions. The last dimension corresponds to the number of predictions, e.g. reco bin number. The second to last dimension corresponds to systematic prediction uncertainties of a single parameter set.

Parameters can be arbitrarily shaped ndarrays. The method must support turning a multiple sets of parameters into an array of predictions:

parameters.shape == ([c,d,...,]n_parameters,)
prediction.shape == ([c,d,...,]n_systematics,n_predictions,)
weights.shape == ([c,d,...,]n_systematics,)

If the systematics_index is specified, only the respective value on the systematics axis should be returned:

prediction.shape == ([c,d,...,]n_predictions,)
weights.shape == ([c,d,...,],)