sample
- pmrf.infer.sample(loglikelihood: Callable[[PyTree], Array] | tuple[Callable, Frequency] | Sequence[Callable[[PyTree], Array] | tuple[Callable, Frequency]], model: PyTreeT | None = None, frequency: Frequency | None = None, solver: AbstractJointSampler | AbstractSplitSampler | AbstractHypercubeSampler = None, *, key: Array | None = None, max_steps: int | None = None, **kwargs) InferResult[PyTreeT]
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 (TermLike | Sequence[TermLike] | pmrf.AbstractProblem) –
An already-built problem, or the log likelihood function to sample. Can be a function or a callable PyTree with optional parameters. If a sequence of log likelihoods is provided, they are automatically summed.
Each may instead be a
(loglikelihood, frequency)pair, or apmrf.Term, binding it to its own frequency sweep rather than the shared one. This allows a single parameter set to be sampled against several datasets on their own grids at once.model (PyTree | None, default=None) – The PyTree containing the parameters to be sampled. Omitted when an already-built problem is passed.
frequency (Frequency | None, default=None) – The frequency sweep over which the log likelihood should be evaluated. May be omitted only if every log likelihood already carries its own frequency.
solver (pmrf.infer.AbstractSampler) – The sampler to use (e.g., MCMC, Nested Sampling, etc.). See
pmrf.inferfor 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 which does not pass the argument.
**kwargs – Additional runtime arguments forwarded to the solver backend.
- Returns:
A structured result containing the sampled model and solver statistics.
- Return type: