InferResult

class pmrf.infer.InferResult(best_problem: AbstractProblem, sampled_problem: AbstractProblem = None, fn_values: Array = None, weights: Array = None, logevidence: Array = None, logevidence_error: Array = None, metrics: Any = None)

Bases: Module, Generic[PyTreeT]

The result of an inference run.

Contains the resultant maximum likelihood/maximum a posterior estimates, as well as the samples, function values and weights for nested sampling runs.

compress_sampled_model(key: Array, **kwargs) PyTreeT

Compresses the sampled model to its approximate channel capacity (entropy) using stochastic rounding, yielding equally weighted samples.

Args:

key: A JAX PRNGKey for resolving fractional probabilities.

Returns:

The compressed sampled model with the self structure as self.sampled_model.

property best_loglikelihood: tuple[Callable[[PyTree], Array], ...]

The maximum likelihood or maximum a posterior of the summed terms.

property best_model: PyTreeT

The maximum likelihood or maximum a posterior parameter PyTree.

best_problem: AbstractProblem

The maximum likelihood or maximum a posterior of the problem.

fn_values: Array = None

The function values related to each sample for Bayesian sampling. Typically, this contains the log likelihood or log posterior values. Only populated for Bayesian sampling algorithms.

logevidence: Array = None

The estimated log evidence, if any.

logevidence_error: Array = None

The estimated error in the log evidence, if any.

metrics: Any = None

The underlying metrics returned by the solver, if any. May be a stripped-down version of the original results object.

property sampled_loglikelihood: tuple[Callable[[PyTree], Array], ...]

Batched terms containing the sampled log-likelihood models.

property sampled_model: PyTreeT

A batched PyTree containing the sampled parameters.

sampled_problem: AbstractProblem = None

A batched problem containing the samples. Only populated for Bayesian sampling algorithms.

weights: Array = None

The weights related to each sample for Bayesian sampling, if any.