Skip to content

Commit

Permalink
add regression test for pymc-devs#3733
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelosthege committed Feb 5, 2020
1 parent bb574a7 commit 8a808f1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pymc3/tests/test_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,27 @@ def test_parallelized_chains_are_random(self):
pass


class TestMetropolis:
def test_tuning_reset(self):
"""Re-use of the step method instance with cores=1 must not leak tuning information between chains."""
with Model() as pmodel:
D = 3
Normal('n', 0, 2, shape=(D,))
trace = sample(
tune=600,
draws=500,
step=Metropolis(tune=True, scaling=0.1),
cores=1,
chains=3,
discard_tuned_samples=False
)
for c in range(trace.nchains):
# check that the tuned settings changed and were reset
assert trace.get_sampler_stats('scaling', chains=c)[0] == 0.1
assert trace.get_sampler_stats('scaling', chains=c)[-1] != 0.1
pass


class TestDEMetropolisZ:
def test_tuning_lambda_sequential(self):
with Model() as pmodel:
Expand Down

0 comments on commit 8a808f1

Please sign in to comment.