Skip to content

Commit a9f84dd

Browse files
committed
Reparameterize according to formulation
1 parent 6bb5ecf commit a9f84dd

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

bayesflow/benchmarks/gaussian_mixture.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
# Corresponds to Task T.7 from the paper https://arxiv.org/pdf/2101.04653.pdf
2222
# NOTE: The paper description uses variances insteas of scales for the likelihood
23-
# but the implementation uses scales. Our implmenetation also uses scales for
24-
# consistency with https://github.com/sbi-benchmark/sbibm/blob/main/sbibm/tasks/gaussian_mixture/task.py
23+
# but the implementation uses scales. Our implmenetation uses variances
2524

2625
import numpy as np
2726

@@ -40,9 +39,9 @@ def prior(lower_bound=-10.0, upper_bound=10.0, D=2, rng=None):
4039
Parameters
4140
----------
4241
lower_bound : float, optional, default : -10
43-
The lower bound of the uniform prior.
42+
The lower bound of the uniform prior
4443
upper_bound : float, optional, default : 10
45-
The upper bound of the uniform prior.
44+
The upper bound of the uniform prior
4645
D : int, optional, default: 2
4746
The dimensionality of the mixture model
4847
rng : np.random.Generator or None, default: None
@@ -51,32 +50,35 @@ def prior(lower_bound=-10.0, upper_bound=10.0, D=2, rng=None):
5150
Returns
5251
-------
5352
theta : np.ndarray of shape (D, )
54-
A single draw from the D-dimensional uniform prior.
53+
A single draw from the D-dimensional uniform prior
5554
"""
5655

5756
if rng is None:
5857
rng = np.random.default_rng()
5958
return rng.uniform(low=lower_bound, high=upper_bound, size=D)
6059

6160

62-
def simulator(theta, prob=0.5, scale_c1=1.0, scale_c2=0.01, rng=None):
61+
def simulator(theta, prob=0.5, scale_c1=1.0, scale_c2=0.1, rng=None):
6362
"""Simulates data from the Gaussian mixture model (GMM) with
6463
shared location vector. For more details, see
6564
6665
https://arxiv.org/pdf/2101.04653.pdf, Benchmark Task T.7
6766
67+
Important: The parameterization uses scales, so use sqrt(var),
68+
if you want to be working with variances instead of scales.
69+
6870
Parameters
6971
----------
7072
theta : np.ndarray of shape (D,)
7173
The D-dimensional vector of parameter locations.
7274
prob : float, optional, default: 0.5
7375
The mixture probability (coefficient).
7476
scale_c1 : float, optional, default: 1.
75-
The scale of the first component.
76-
scale_c2 : float, optional, default: 0.01
77-
The scale of the second component.
77+
The scale of the first component
78+
scale_c2 : float, optional, default: 0.1
79+
The scale of the second component
7880
rng : np.random.Generator or None, default: None
79-
An optional random number generator to use.
81+
An optional random number generator to use
8082
8183
Returns
8284
-------

0 commit comments

Comments
 (0)