Skip to content

Commit 02a3fa5

Browse files
ricardoV94michaelosthege
authored andcommitted
Fix float32 rtol in test_mle_jacobian
1 parent bb253c5 commit 02a3fa5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pymc3/tests/test_tuning.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from pymc3.step_methods.metropolis import tune
2020
from pymc3.tests import models
21+
from pymc3.tests.helpers import select_by_precision
2122
from pymc3.tuning import find_MAP, scaling
2223

2324

@@ -36,18 +37,16 @@ def test_guess_scaling():
3637
def test_mle_jacobian():
3738
"""Test MAP / MLE estimation for distributions with flat priors."""
3839
truth = 10.0 # Simple normal model should give mu=10.0
40+
rtol = select_by_precision(float64=1e-6, float32=1e-4)
3941

4042
start, model, _ = models.simple_normal(bounded_prior=False)
4143
with model:
4244
map_estimate = find_MAP(method="BFGS", model=model)
43-
44-
rtol = 1e-5 # this rtol should work on both floatX precisions
4545
np.testing.assert_allclose(map_estimate["mu_i"], truth, rtol=rtol)
4646

4747
start, model, _ = models.simple_normal(bounded_prior=True)
4848
with model:
4949
map_estimate = find_MAP(method="BFGS", model=model)
50-
5150
np.testing.assert_allclose(map_estimate["mu_i"], truth, rtol=rtol)
5251

5352

0 commit comments

Comments
 (0)