rxmc.evidence.Evidence#
- class rxmc.evidence.Evidence(constraints: list[Constraint] | None = None, parametric_constraints: list[Constraint] | None = None, weights: ndarray = None, weights_parametric: ndarray = None)[source]#
Bases:
objectA collection of independent constraints sharing a common physical model.
Each
Constraintrepresents a set of observations paired with a likelihood model. All constraints must share the same physical-model parameters, but may have different likelihood-model parameters.Optional per-constraint weights scale the contribution of each constraint to the total log likelihood.
- Parameters:
constraints (list of Constraint, optional) – Constraints whose likelihood models have no free parameters.
parametric_constraints (list of Constraint, optional) – Constraints whose likelihood models have free parameters.
weights (np.ndarray, optional) – 1-D array of weights for constraints. Defaults to all ones.
weights_parametric (np.ndarray, optional) – 1-D array of weights for parametric_constraints. Defaults to all ones.
- Raises:
ValueError – If both constraints and parametric_constraints are empty.
ValueError – If any constraint uses different physical-model parameters than the first.
ValueError – If a non-parametric constraint appears in parametric_constraints, or vice versa.
ValueError – If the number of data points is less than the number of free parameters (under-constrained model).
ValueError – If weights or weights_parametric do not match the corresponding list length.
- __init__(constraints: list[Constraint] | None = None, parametric_constraints: list[Constraint] | None = None, weights: ndarray = None, weights_parametric: ndarray = None)[source]#
Methods
__init__([constraints, ...])log_likelihood(model_params[, likelihood_params])Weighted sum of log likelihoods over all constraints.
- log_likelihood(model_params, likelihood_params: list[tuple] | None = None)[source]#
Weighted sum of log likelihoods over all constraints.
- Parameters:
model_params (tuple) – Parameters of the physical model.
likelihood_params (list of tuple, optional) – One tuple of likelihood parameters per entry in parametric_constraints. Defaults to an empty list.
- Returns:
float – Total weighted log likelihood.