bayesflow.benchmarks.slcp_distractors module#
- bayesflow.benchmarks.slcp_distractors.get_random_student_t(dim=2, mu_scale=15, shape_scale=0.01, rng=None)[source]#
A helper function to create a “frozen” multivariate student-t distribution of dimensions dim.
- Parameters:
- dimint, optional, default: 2
The dimensionality of the student-t distribution.
- mu_scalefloat, optional, default: 15
The scale of the zero-centered Gaussian prior from which the mean vector of the student-t distribution is drawn.
- shape_scalefloat, optional, default: 0.01
The scale of the assumed np.eye(dim) shape matrix. The default is chosen to keep the scale of the distractors and observations relatively similar.
- rngnp.random.Generator or None, default: None
An optional random number generator to use.
- Returns:
- studentcallable (scipy.stats._multivariate.multivariate_t_frozen)
The student-t generator.
- bayesflow.benchmarks.slcp_distractors.draw_mixture_student_t(num_students, n_draws=46, dim=2, mu_scale=15.0, rng=None)[source]#
Helper function to generate n_draws random draws from a mixture of num_students multivariate Student-t distributions.
Uses the function get_random_student_t to create each of the studen-t callable objects.
- Parameters:
- num_studentsint
The number of multivariate student-t mixture components
- n_drawsint, optional, default: 46
The number of draws to obtain from the mixture distribution.
- dimint, optional, default: 2
The dimensionality of each student-t distribution in the mixture.
- mu_scalefloat, optional, default: 15
The scale of the zero-centered Gaussian prior from which the mean vector of each student-t distribution in the mixture is drawn.
- rngnp.random.Generator or None, default: None
An optional random number generator to use.
- Returns:
- samplenp.ndarray of shape (n_draws, dim)
The random draws from the mixture of students.
- bayesflow.benchmarks.slcp_distractors.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.
- 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_distractors.simulator(theta, n_obs=4, n_dist=46, dim=2, mu_scale=15.0, 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. In addition, it outputs uninformative distractor data.
See https://arxiv.org/pdf/2101.04653.pdf, Benchmark Task T.4
- 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.
- n_distint, optional, default: 46
The number of distractor to draw from the distractor likelihood.
- dimint, optional, default: 2
The dimensionality of each student-t distribution in the mixture.
- mu_scalefloat, optional, default: 15
The scale of the zero-centered Gaussian prior from which the mean vector of each student-t distribution in the mixture is drawn.
- 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 + n_dist*2,) if flatten=True, otherwise
np.ndarray of shape (n_obs + n_dist, 2) if flatten=False