pmrf.distributions.maf
Functions
|
Classes
|
A generic NumPyro-compatible distribution wrapper for MAF-based models. |
- class pmrf.distributions.maf.MAFDistribution(maf_or_path, backend='margarine_maf', validate_args=None)[source]
Bases:
Distribution
A generic NumPyro-compatible distribution wrapper for MAF-based models. The actual implementation is delegated to a backend adapter.
- support = RealVector(Real(), 1)
- has_rsample = False
- classmethod load(path, backend='margarine_maf', validate_args=None)[source]
Load a MAFDistribution from a file using the specified backend.
- classmethod generate(data, weights=None, backend='margarine_maf', validate_args=None, **kwargs)[source]
- sample(key, sample_shape=())[source]
Returns a sample from the distribution having shape given by sample_shape + batch_shape + event_shape. Note that when sample_shape is non-empty, leading dimensions (of size sample_shape) of the returned sample will be filled with iid draws from the distribution instance.
- Parameters:
key (jax.random.PRNGKey) – the rng_key key to be used for the distribution.
sample_shape (tuple) – the sample shape for the distribution.
- Returns:
an array of shape sample_shape + batch_shape + event_shape
- Return type:
numpy.ndarray
- log_prob(value)[source]
Evaluates the log probability density for a batch of samples given by value.
- Parameters:
value – A batch of samples from the distribution.
- Returns:
an array with shape value.shape[:-self.event_shape]
- Return type:
numpy.ndarray
- icdf(u)[source]
The inverse cumulative distribution function of this distribution.
- Parameters:
q – quantile values, should belong to [0, 1].
- Returns:
the samples whose cdf values equals to q.
- property min
- property max