bayesflow.benchmarks.bernoulli_glm module

bayesflow.benchmarks.bernoulli_glm module#

bayesflow.benchmarks.bernoulli_glm.prior(rng=None)[source]#

Generates a random draw from the custom prior over the 10 Bernoulli GLM parameters (1 intercept and 9 weights). Uses a global covariance matrix Cov for the multivariate Gaussian prior over the model weights, which is pre-computed for efficiency.

Parameters:
rngnp.random.Generator or None, default: None

An optional random number generator to use.

Returns:
thetanp.ndarray of shape (10,)

A single draw from the prior.

bayesflow.benchmarks.bernoulli_glm.simulator(theta, T=100, scale_by_T=True, rng=None)[source]#

Simulates data from the custom Bernoulli GLM likelihood, see https://arxiv.org/pdf/2101.04653.pdf, Task T.5

Important: scale_sum should be set to False if the simulator is used with variable T during training, otherwise the information of T will be lost.

Parameters:
thetanp.ndarray of shape (10,)

The vector of model parameters (theta[0] is intercept, theta[i], i > 0 are weights).

Tint, optional, default: 100

The simulated duration of the task (eq. the number of Bernoulli draws).

scale_by_Tbool, optional, default: True

A flag indicating whether to scale the summayr statistics by T.

rngnp.random.Generator or None, default: None

An optional random number generator to use.

Returns:
xnp.ndarray of shape (10,)

The vector of sufficient summary statistics of the data.

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

Configures simulator outputs for use in BayesFlow training.