Skip to content

Commit 2efedc1

Browse files
lucianopaztwiecki
authored andcommitted
Fix flaky density dist prior predictive test
1 parent d4a4d03 commit 2efedc1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pymc/tests/test_sampling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ def test_density_dist(self):
10741074
obs = np.random.normal(-1, 0.1, size=10)
10751075
with pm.Model():
10761076
mu = pm.Normal("mu", 0, 1)
1077-
sd = pm.Gamma("sd", 1, 2)
1077+
sd = pm.HalfNormal("sd", 1e-6)
10781078
a = pm.DensityDist(
10791079
"a",
10801080
mu,
@@ -1084,7 +1084,7 @@ def test_density_dist(self):
10841084
)
10851085
prior = pm.sample_prior_predictive(return_inferencedata=False)
10861086

1087-
npt.assert_almost_equal(prior["a"].mean(), 0, decimal=1)
1087+
npt.assert_almost_equal((prior["a"] - prior["mu"][..., None]).mean(), 0, decimal=3)
10881088

10891089
def test_shape_edgecase(self):
10901090
with pm.Model():

0 commit comments

Comments
 (0)