ComposedPredictor
- class remu.likelihood.ComposedPredictor(predictors, combine_systematics='cartesian')[source]
Bases:
remu.likelihood.Predictor
Wrapper class that composes different Predictors into one.
- 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.
- combine_systematicsstring, optional
The strategy how to combine the systematics of the Predictors. Default: “cartesian”
Notes
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[, systematics_index])Turn a set of parameters into an ndarray of predictions.
- 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
ornp.nan
.
See also
- prediction(parameters, systematics_index=slice(None, None, None))[source]
Turn a set of parameters into an ndarray of predictions.
- Parameters
- parametersndarray
- systematics_indexint, optional
- Returns
- prediction, weightsndarray
Notes
The optional argument systematics_index will be applied to the final output of the composed predictions, e.g. the flattened Cartesian product of the intermediate systematics if the combination strategy is “cartesian”.