MarginalLogLikelihood

class pmrf.evaluators.MarginalLogLikelihood(predictor: Callable[[Model, Frequency], jnp.ndarray], data: jnp.ndarray, likelihood: Callable[[jnp.ndarray], dist.AbstractDistribution], discrepancy: Callable[[jnp.ndarray, jnp.ndarray], dist.AbstractDistribution] | None = None, event_mapper: Callable[[jnp.ndarray], jnp.ndarray] | None = None, event_ndims: int = 1, *, name: str | None = None)

Bases: Evaluator

Computes the log of the probability of observing some data by conditioning a likelihood function on a model prediction while marginalizing out a potential discrepancy model.

Performs the mapping from “data space” to “event space”. By default, this defines the frequency axis as the probabilistic event, by moving it to the last axis before passing it to the likelihood/discrepancy. Real and imaginary parts are also stacked appropriately.

__call__(model: Model, frequency: Frequency, **kwargs) Array

Evaluate the model response over the specified frequency range.

Parameters:
  • model (Model) – The model instance to evaluate.

  • freq (Frequency) – The frequency object defining the evaluation points.

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

Returns:

The evaluated model response.

Return type:

jnp.ndarray

data: Array

The fixed ‘observed’ data that the log probability will be computed of.

discrepancy: Callable[[Array, Array], AbstractDistribution] | None = None

An optional discrepancy model to cater for model misspecification. Can be a function or a PyTree with optional parameters. See pmrf.discrepancy_models for common discrepancy models.

event_mapper: Callable[[Array], Array] | None = None

A mapper to map the “data space” (predicted features) to an “event space” (probability).

event_ndims: int = 1

The number of trailing event dimensions returned by the event mapped. Defaults to 1.

likelihood: Callable[[Array], AbstractDistribution]

The likelihood function that takes the model prediction and returns the probability of observing some data. Can be a function or a PyTree with optional parameters. See pmrf.likelihoods for common likelihoods.

predictor: Callable[[Model, Frequency], Array]

The predictor (e.g. another Evaluator) that extracts model features. Can be a function or a PyTree with optional parameters.