sample

pmrf.infer.sample(loglikelihood: Callable[[ModelT, Frequency], Array] | list[Callable], model: ModelT, frequency: Frequency, solver: AbstractJointSampler | AbstractSplitSampler | AbstractHypercubeSampler, *, key: Array | None = None, max_steps: int | None = None, **kwargs) InferResult[ModelT]

Samples a given log likelihood function for a model over a frequency range.

This function uses Bayesian sampling algorithms to represent the full posterior distribution of a model as a collection of parameter samples. This is in contrast to classical minimization techniques in pmrf.optimize.

The log likelihood function can have its own hyper-parameters, and is returned in result.loglikelihood.

Parameters:
  • loglikelihood (Callable[[Model, Frequency], jnp.ndarray] | list[Callable],) – The log likelihood function to sample. Can be a function or a callable PyTree with optional parameters. If a list of log likelihoods is provided, they are automatically summed.

  • model (Model) – The RF model containing the parameters to be sample.

  • frequency (Frequency) – The frequency sweep over which the log likelihood should be evaluated.

  • solver (pmrf.infer.AbstractSampler) – The sampler to use (e.g., MCMC, Nested Sampling, etc.). See pmrf.infer for available solvers.

  • key (jnp.ndarray, optional) – The random JAX key. Automatically generated if not passed.

  • options (dict) – Additional options passed to the underlying solver backend.

  • max_steps (int | None, default=None) – The maximum number of sampling steps to take. Defaults to None i.e. no limit.

  • **kwargs – Additional runtime arguments forwarded to the solver backend.

Returns:

A structured result containing the sampled model and solver statistics.

Return type:

InferResult