ComposedMatrixPredictor

class remu.likelihood.ComposedMatrixPredictor(predictors, evaluation_point=None, evaluation_steps=None, **kwargs)[source]

Bases: remu.likelihood.MatrixPredictor, remu.likelihood.ComposedPredictor

Composition of MatrixPredictors.

Parameters
predictorslist of Predictor

The Predictors will be composed in turn. The second must predict parameters for the first, the third for the second, etc. The last Predictor defines what parameters will be accepted by the resulting Predictor.

evaluation_pointarray_like float, optional

Shape: (n_parameters,) Anchor point for the linearisation.

evaluation_stepsarray_like float, optional

Shape: (n_parameters,) Step away from the anchor point for the linearisation.

combine_systematicsstring, optional

The strategy how to combine the systematics of the Predictors. Default: “cartesian”

Notes

This MatrixPredictor will calculate a linear coefficients and offsets by evaluating the composed provided predictors at evaluation_point. The gradient at that point will be calculated by adding the evaluation_steps for each parameter separately.

For a composition of multiple MatrixPredictor, this will still lead to an exact representation (modulo variations from numerical accuracy). For non-linear, generic Predictor, this means we are generating a linear approximation at evaluation_point.

If no evaluation_point or evaluation_steps is provided, they will be generated from the last predictor’s defaults and bounds.

Warning

The auto-generated steps should work for linear functions, but might be completely unsuitable, i.e. too large, for linear approximations of general functions.

Systematics will be handled according to the combine_systematics parameter. Possible values are:

"cartesian"

Combine systematics in a Cartesian product. There will be one output prediction for each possible combination of intermediate systematics.

"same"

Assume that the systamtics are the same and no combination is done. The dimensions and weights for the systematics _must_ be identical for all provided Predictors.

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, *args, **kwargs)

Turn a set of parameters into a reco prediction.

check_bounds(parameters)

Check that all parameters are within bounds.

compose(other)

Return a new Predictor that is a composition with other.

new_predictor(parameters) = self(other(parameters))
fix_parameters(fix_values)

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, *args, **kwargs)

Turn a set of parameters into a reco prediction.

Returns
predictionndarray
weightsndarray