SummedTerms
- class pmrf.objectives.SummedTerms(model: PyTree, terms: Any)
Bases:
AbstractProblemA problem summing a set of terms over a tree of parameters.
Each term is a callable that accepts the tree and returns a result.
pmrf.BoundEvaluatorcan be used to bind an evaluator (such as a loss or likelihood) to a frequency sweep, whilst a term that requires no frequency, such as a penalty on the parameters, can be passed as a plain callable.- Parameters:
model (jaxtyping.PyTree) – The tree of parameters to evaluate, typically an RF model.
terms (tuple[Callable[[jaxtyping.PyTree], jax.jaxlib._jax.Array], ...]) – The terms to sum. Each maps the tree to a scalar or array result.
- __call__(*args, **kwargs) Array
Evaluate the problem.
- whitened_residual(*args, **kwargs) Array
Returns the whitened residuals of the terms, stacked into one vector.
Half its squared norm is the problem’s value, up to terms constant in the model parameters (ADR-0009).
- Raises:
NotImplementedError – If a term has no whitened residual.
- model: PyTree
The tree of parameters being solved for.
- terms: tuple[Callable[[PyTree], Array], ...]
The terms summed to produce the result.