bayesflow.benchmarks.gaussian_linear_uniform module

bayesflow.benchmarks.gaussian_linear_uniform module#

bayesflow.benchmarks.gaussian_linear_uniform.prior(D=10, lower_bound=-1.0, upper_bound=1.0, rng=None)[source]#

Generates a random draw from a D-dimensional uniform prior bounded between lower_bound and upper_bound which represents the location vector of a (conjugate) Gaussian likelihood.

Parameters:
Dint, optional, default10

The dimensionality of the Gaussian prior.

lower_boundfloat, optional, default-1.

The lower bound of the uniform prior.

upper_boundfloat, optional, default1.

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 (D, )

A single draw from the D-dimensional uniform prior.

bayesflow.benchmarks.gaussian_linear_uniform.simulator(theta, n_obs=None, scale=0.1, rng=None)[source]#

Generates batched draws from a D-dimenional Gaussian distributions given a batch of location (mean) parameters of D dimensions. Assumes a spherical convariance matrix given by scale * I_D.

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

The location parameters of the Gaussian likelihood.

n_obsint or None, optional, default: None

The number of observations to draw from the likelihood given the location parameter theta. If None, a single draw is produced.

scalefloat, optional, default0.1

The scale of the Gaussian likelihood.

rngnp.random.Generator or None, default: None

An optional random number generator to use.

Returns:
xnp.ndarray of shape (theta.shape[0], theta.shape[1]) if n_obs is None,

else np.ndarray of shape (theta.shape[0], n_obs, theta.shape[1]) A single draw or a sample from a batch of Gaussians.

bayesflow.benchmarks.gaussian_linear_uniform.configurator(forward_dict, mode='posterior')[source]#

Configures simulator outputs for use in BayesFlow training.