GaussianMixture#
- class bayesflow.simulators.GaussianMixture(D: int = 2, lower_bound: float = -10.0, upper_bound: float = 10.0, prob: float = 0.5, scale_c1: float = 1.0, scale_c2: float = 0.1, rng: Generator = None)[source]#
Bases:
BenchmarkSimulator
Gaussian Mixture simulated benchmark See: https://arxiv.org/pdf/2101.04653.pdf, Task T.7
Important: The parameterization uses scales, so use sqrt(var), if you want to be working with variances instead of scales.
- Parameters:
- D: int, optional, default: 2
The dimensionality of the mixture model.
- lower_bound: float, optional, default: -10.0
The lower bound of the uniform prior.
- upper_bound: float, optional, default: 10.0
The upper bound of the uniform prior.
- prob: float, optional, default: 0.5
The mixture probability (coefficient).
- scale_c1: float, optional, default: 1.0
The scale of the first component.
- scale_c2: float, optional, default: 0.1
The scale of the second component.
- rng: np.random.Generator or None, optional, default: None
An optional random number generator to use.
- prior()[source]#
Generates a random draw from a 2-dimensional uniform prior bounded between lower_bound and upper_bound representing the common mean of a 2D Gaussian mixture model (GMM).
- Returns:
- paramsnp.ndarray of shape (D, )
A single draw from the D-dimensional uniform prior
- observation_model(params: ndarray)[source]#
Simulates data from the Gaussian mixture model (GMM) with shared location vector. For more details, see
- Parameters:
- paramsnp.ndarray of shape (D, )
The D-dimensional vector of parameter locations.
- Returns:
- xnp.ndarray of shape (2, )
The 2D vector generated from the GMM simulator.
- rejection_sample(batch_shape: tuple[int, ...], predicate: Callable[[dict[str, ndarray]], ndarray], *, axis: int = 0, sample_size: int = None, **kwargs) dict[str, ndarray] #
- sample(batch_shape: tuple[int, ...], **kwargs) dict[str, ndarray] #
Runs simulated benchmark and returns batch_size parameter and observation batches
- Parameters:
- batch_shape: tuple
Number of parameter-observation batches to simulate.
- Returns:
- dict[str, np.ndarray]: simulated parameters and observables
with shapes (batch_size, …)