prior

jaxns.framework.prior

Module Contents

exception InvalidPriorName(name=None)[source]

Bases: Exception

Raised when a prior name is already taken.

Initialize self. See help(type(self)) for accurate signature.

Parameters:

name (Optional[str])

class Prior(dist_or_value, name=None)[source]

Bases: jaxns.framework.bases.BaseAbstractPrior

Represents a generative prior.

Parameters:
  • dist_or_value (Union[tfpd, jaxns.internals.types.FloatArray, jaxns.internals.types.IntArray, jaxns.internals.types.BoolArray])

  • name (Optional[str])

name = None[source]
property dist: jaxns.framework.bases.BaseAbstractDistribution[source]
Return type:

jaxns.framework.bases.BaseAbstractDistribution

property value: jax.Array[source]
Return type:

jax.Array

parametrised(random_init=False)[source]

Convert this prior into a non-Bayesian parameter, that takes a single value in the model, but still has an associated log_prob. The parameter is registered as a get_parameter with added _param name suffix. Prior must have a name.

Parameters:

random_init (bool) – whether to initialise the parameter randomly or at the median of the distribution.

Returns:

A singular prior.

Raises:

ValueError – if the prior has no name.

Return type:

SingularPrior