CompositeHypothesis¶
-
class
remu.likelihood.
CompositeHypothesis
(translation_function, parameter_limits=None, parameter_priors=None, parameter_names=None)¶ A CompositeHypothesis translates a set of parameters into a truth vector.
Parameters: - translation_function : function
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_limits : iterable of tuples of floats, optional
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), ... ]
Parameter limits are used in likelihood maximization.
- parameter_priors : iterable of functions, optional
An iterable of prior probability density functions. The number of priors determines the number of parameters. Each function must return the logarithmic probability density, given a value of the corresponding parameter:
prior(value=default) = log( pdf(value) )
They should return
-numpy.inf
for excluded values. The function’s argument must be named value and a default must be provided. Parameter priors are used in Marcov Chain Monte Carlo evaluations.- parameter_names : iterable of strings, optional
Iterable of the parameter names. These names will be used in some plotting comvenience functions.
Notes
Depending on the use case, one can provide parameter_limits and/or parameter_priors, but they are not checked for consistency!
-
fix_parameters
(fix_values)¶ Return a new CompositeHypothesis by fixing some parameters.
Parameters: - fix_values : iterable of values
This iterable must have the same length as the vector of parameters of the CompositeHypothesis. The parameters of the new CompositeHypothesis are fixed to the given values. Parameters that should not be fixed must be specified with
None
. For example, to fix the first and third parameter of a 3-parameter hypothesis, fix_values must look like this:(1.23, None, 9.87)
The resulting CompositeHypothesis has one free parameter, the second parameter of the original hypothesis.
-
translate
(parameters)¶ Translate the parameter vector to a truth vector.
Parameters: - parameters : ndarray like
Vector of the hypothesis parameters.
Returns: - ndarray
Vector of the corresponding truth space expectation values.