bayesflow.benchmarks.gaussian_linear module

bayesflow.benchmarks.gaussian_linear module#

bayesflow.benchmarks.gaussian_linear.prior(D=10, scale=0.1, rng=None)[source]#

Generates a random draw from a D-dimensional Gaussian prior distribution with a spherical scale matrix given by sigma * I_D. Represents the location vector of a (conjugate) Gaussian likelihood.

Parameters:
Dint, optional, default10

The dimensionality of the Gaussian prior distribution.

scalefloat, optional, default0.1

The scale of the Gaussian 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 Gaussian prior.

bayesflow.benchmarks.gaussian_linear.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 n obs is 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.configurator(forward_dict, mode='posterior')[source]#

Configures simulator outputs for use in BayesFlow training.