AbstractTerm

class pmrf.terms.AbstractTerm(*, name: str | None = None, metadata: Any = None)

Bases: Module

Abstract base class for callables that evaluate a model.

Terms are the summands of a pmrf.SummedTerms. An evaluator takes both a PyTree and a frequency, whereas a term takes only a PyTree, having already resolved the frequency that it needs.

Inheriting from this class is optional. Any callable that accepts a PyTree is a valid term, meaning that a once-off penalty can simply be written as a function.

abstractmethod __call__(model: PyTree, **kwargs) Array

Evaluate the model.

Parameters:
  • model (PyTree) – The parameter PyTree to evaluate.

  • **kwargs (dict) – Additional keyword arguments for the evaluation process.

Returns:

The evaluated result.

Return type:

jnp.ndarray