bayesflow.benchmarks.slcp module

bayesflow.benchmarks.slcp module#

bayesflow.benchmarks.slcp.prior(lower_bound=-3.0, upper_bound=3.0, rng=None)[source]#

Generates a random draw from a 5-dimensional uniform prior bounded between lower_bound and upper_bound which represents the 5 parameters of the SLCP simulator.

Parameters:
lower_boundfloat, optional, default-3

The lower bound of the uniform prior.

upper_boundfloat, optional, default3

The upper bound of the uniform prior.

rngnp.random.Generator or None, default: None

An optional random number generator to use.

Returns:
thetanp.ndarray of shape (5, )

A single draw from the 5-dimensional uniform prior.

bayesflow.benchmarks.slcp.simulator(theta, n_obs=4, flatten=True, rng=None)[source]#

Generates data from the SLCP model designed as a benchmark for a simple likelihood and a complex posterior due to a non-linear pushforward theta -> x.

See https://arxiv.org/pdf/2101.04653.pdf, Benchmark Task T.3

Parameters:
thetanp.ndarray of shape (theta, D)

The location parameters of the Gaussian likelihood.

n_obsint, optional, default: 4

The number of observations to generate from the slcp likelihood.

flattenbool, optional, default: True

A flag to indicate whather a 1D (flatten=True) or a 2D (flatten=False) representation of the simulated data is returned.

rngnp.random.Generator or None, default: None

An optional random number generator to use.

Returns:
xnp.ndarray of shape (n_obs*2, ) or (n_obs, 2), as indictated by the flatten

boolean flag. The sample of simulated data from the SLCP model.

bayesflow.benchmarks.slcp.configurator(forward_dict, mode='posterior', scale_data=30.0, as_summary_condition=False)[source]#

Configures simulator outputs for use in BayesFlow training.