jaxili.posterior.base_posterior module#

Base Posterior.

This module contains the base class for Neural Posteriors. Classes used to sample in NPE and NLE will inherit from this class.

class jaxili.posterior.base_posterior.NeuralPosterior(model: NDENetwork, state: TrainState, verbose: bool = False, x: Array | None = None)[source]#

Bases: object

Posterior $p(theta|x)$ with log_prob() and sample() methods.

The class wraps the trained neural network such that one can directly evaluate the log-probability and sample from the posterior.

Methods

sample(num_samples, key, x[, mcmc_method, ...])

Define abstract method to sample from the posterior.

set_default_x(x)

Set the default data for the posterior.

unnormalized_log_prob(theta)

Define abstract method to compute the unnormalized log-probability of a given parameter.

abstract sample(num_samples: int, key: Array, x: Array, mcmc_method: str | None = None, mcmc_kwargs: Dict[str, Any] | None = None)[source]#

Define abstract method to sample from the posterior. The sampling method depends on the methodology used.

set_default_x(x: Array)[source]#

Set the default data for the posterior.

abstract unnormalized_log_prob(theta: Array)[source]#

Define abstract method to compute the unnormalized log-probability of a given parameter.