Prior distribution#

We support Gaussian prior distributions, specifically IsotropicGaussianPrior and DiagonalGaussianPrior.

Alternatively, you can bring your own prior distribution by overwriting the abstract class Prior. Please find the references below.

class fortuna.prob_model.prior.base.Prior[source]#

Abstract prior distribution class.

abstract log_joint_prob(params)[source]#

Evaluate the prior log-probability density function (a.k.a. log-pdf).

Parameters:

params (PyTree) – The parameters where to evaluate the log-pdf.

Returns:

Evaluation of the prior log-pdf.

Return type:

float

property rng: RandomNumberGenerator#

Invoke the random number generator object.

Return type:

The random number generator object.

abstract sample(params_like, rng=None)[source]#

Sample parameters from the prior distribution.

Parameters:
  • params_like (PyTree) – An PyTree object with the same structure as the parameters to sample.

  • rng (Optional[PRNGKeyArray]) – A random number generator. If not passed, this will be taken from the attributes of this class.

Returns:

A sample from the prior distribution.

Return type:

PyTree

class fortuna.prob_model.prior.gaussian.DiagonalGaussianPrior(log_var)[source]#

A diagonal Gaussian prior class.

Parameters:

log_var (jnp.ndarray) – Prior log-variance vector corresponding to the logarithm of the diagonal of the prior covariance matrix.

log_joint_prob(params)[source]#

Evaluate the prior log-probability density function (a.k.a. log-pdf).

Parameters:

params (PyTree) – The parameters where to evaluate the log-pdf.

Returns:

Evaluation of the prior log-pdf.

Return type:

float

property rng: RandomNumberGenerator#

Invoke the random number generator object.

Return type:

The random number generator object.

sample(params_like, rng=None)[source]#

Sample parameters from the prior distribution.

Parameters:
  • params_like (PyTree) – An PyTree object with the same structure as the parameters to sample.

  • rng (Optional[PRNGKeyArray]) – A random number generator. If not passed, this will be taken from the attributes of this class.

Returns:

A sample from the prior distribution.

Return type:

PyTree

class fortuna.prob_model.prior.gaussian.IsotropicGaussianPrior(log_var=0.0)[source]#

A diagonal Gaussian prior class.

Parameters:

log_var (Optional[float]) – Prior log-variance value. The covariance matrix of the prior distribution is given by a diagonal matrix with this parameter on every entry of the diagonal.

log_joint_prob(params)[source]#

Evaluate the prior log-probability density function (a.k.a. log-pdf).

Parameters:

params (PyTree) – The parameters where to evaluate the log-pdf.

Returns:

Evaluation of the prior log-pdf.

Return type:

float

property rng: RandomNumberGenerator#

Invoke the random number generator object.

Return type:

The random number generator object.

sample(params_like, rng=None)[source]#

Sample parameters from the prior distribution.

Parameters:
  • params_like (PyTree) – An PyTree object with the same structure as the parameters to sample.

  • rng (Optional[PRNGKeyArray]) – A random number generator. If not passed, this will be taken from the attributes of this class.

Returns:

A sample from the prior distribution.

Return type:

PyTree