jesterTOV.inference.base.prior.SequentialTransformPrior#

class SequentialTransformPrior(base_prior, transforms)[source]#

Bases: Prior

Transform a prior distribution by applying a sequence of transforms.

Note: This class follows the Jim/jimgw architecture.

The space before the transform is named as x, and the space after the transform is named as z.

__init__(base_prior, transforms)[source]#

Methods

__init__(base_prior, transforms)

add_name(x)

Turn an array into a dictionary.

log_prob(z)

Evaluate the probability of the transformed variable z.

sample(rng_key, n_samples)

Sample from the transformed prior.

transform(x)

Apply forward transforms to x.

Attributes

n_dim

base_prior

transforms

parameter_names

composite

base_prior: Prior#
log_prob(z)[source]#

Evaluate the probability of the transformed variable z.

This is what flowMC should sample from.

Parameters:

z (dict[str, Float]) – Dictionary of parameter names to values in transformed space.

Return type:

Float

Returns:

log_prob (Float) – The log probability including Jacobian correction.

sample(rng_key, n_samples)[source]#

Sample from the transformed prior.

Parameters:
  • rng_key (PRNGKeyArray) – A random key to use for sampling.

  • n_samples (int) – The number of samples to draw.

Return type:

dict[str, Float[Array, 'n_samples']]

Returns:

samples (dict) – Samples from the transformed distribution.

transform(x)[source]#

Apply forward transforms to x.

Parameters:

x (dict[str, Float]) – Dictionary of parameter names to values.

Return type:

dict[str, Float]

Returns:

z (dict[str, Float]) – Transformed dictionary.

transforms: list[BijectiveTransform]#