rxmc.evidence.Evidence#
- class rxmc.evidence.Evidence(constraints: list[Constraint] | None = None, weights: ndarray = None)[source]#
Bases:
objectA collection of independent constraints sharing a common physical model.
- Parameters:
constraints (list of Constraint) – All constraints. Those with
n_params > 0are exposed (in order) asparametric_constraints.weights (np.ndarray, optional) – 1-D array of per-constraint weights. Defaults to all ones.
- Raises:
ValueError – If constraints is empty, if any constraint uses different physical-model parameters than the first, if the model is under-constrained, or if weights does not match the constraint count.
- constraints#
All constraints.
- Type:
list of Constraint
- parametric_constraints#
The subset with
n_params > 0, in the order they appear.- Type:
list of Constraint
- parametric_indices#
Global index into
constraintsfor each entry ofparametric_constraints(e.g. to look up itsweightsentry).
Methods
__init__([constraints, weights])log_likelihood(model_params[, cov_params])Weighted sum of log likelihoods over all constraints.
weighted_marginal_log_likelihood(lm_index, ...)Weighted marginal log likelihood of one parametric constraint.
- log_likelihood(model_params, cov_params: list | None = None)[source]#
Weighted sum of log likelihoods over all constraints.
- Parameters:
model_params (tuple) – Physical-model parameters.
cov_params (list of tuple, optional) – One tuple of constraint parameters per entry in
parametric_constraints(in that order). Defaults to[].
- Returns:
float – Total weighted log likelihood.
- weighted_marginal_log_likelihood(lm_index, ym, *cov_params)[source]#
Weighted marginal log likelihood of one parametric constraint.
Applies the same
weightsentry thatlog_likelihood()uses for this constraint, so Gibbs-style conditional updates target the same joint distribution as the model block.- Parameters:
lm_index (int) – Index into
parametric_constraints.ym (list of np.ndarray) – One prediction array per observation of that constraint.
*cov_params (float) – The constraint’s parameters, in its
paramsorder.