gwkokab.analysis.utils.priorsΒΆ

FunctionsΒΆ

DirichletElement(β†’ numpyro.distributions.Distribution)

Conditional Dirichlet Distribution.

get_processed_priors(β†’ dict)

Get the processed priors from a list of parameters.

Module ContentsΒΆ

gwkokab.analysis.utils.priors.DirichletElement(order: int, n_dimensions: int, validate_args: bool | None = None, **kwargs) numpyro.distributions.DistributionΒΆ

Conditional Dirichlet Distribution.

A DirichletElement is a distribution over the \(N\)-dimensional simplex, where \(N\) is the n_dimensions parameter. The \(n\)-th order Dirichlet distribution given by the order. The distribution is defined as,

\[\forall n \in \{0, N-2\}, p(x_n \mid x_0, \cdots, x_{n-1}) = \frac{(N-n-1)(1-\alpha_n-x_n)^{N-n-1}}{(1-\alpha_n)^{N-n-1}}, \qquad x_n \in [0, \alpha_n]\]

where \(\alpha_n = \sum_{i=0}^{n-1} \alpha_i\) and \(x_n\) is the order-th element of the simplex.

\[p(x_{N-1}\mid x_0, \cdots, x_{N-2}) = \frac{1}{1-\alpha_{N-1}}, \qquad x_{N-1} \in [0,\alpha_{N-1}]\]
Parameters:
  • order (int) – order of the DirichletElement

  • n_dimensions (int) – number of dimensions

  • validate_args (Optional[bool], optional) – whether to validate the arguments, by default None

Returns:

DirichletElement distribution

Return type:

Distribution

Raises:

KeyError – Missing concentration parameters for DirichletElement of order {order}

gwkokab.analysis.utils.priors.get_processed_priors(params: List[str], priors: dict) dictΒΆ

Get the processed priors from a list of parameters.

A processed prior is either an instantiated prior or a tuple of (jax.tree_util.Partial, lazy_vars) where lazy_vars is a dictionary of lazy variables.

Parameters:
  • params (List[str]) – list of parameters

  • priors (dict) – dictionary of priors

Returns:

dictionary of processed priors

Return type:

dict

Raises:

ValueError – if the prior value is invalid