Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seed flaky test TestSamplePPC.test_normal_scalar #6220

Merged
merged 5 commits into from
Oct 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pymc/tests/test_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,8 @@ def test_normal_scalar(self):
ppc0 = pm.sample_posterior_predictive(
10 * [model.initial_point()], return_inferencedata=False
)
# # deprecated argument is not introduced to fast version [2019/08/20:rpg]
ppc = pm.sample_posterior_predictive(trace, var_names=["a"], return_inferencedata=False)
assert "a" in ppc0
assert len(ppc0["a"][0]) == 10
# test empty ppc
ppc = pm.sample_posterior_predictive(trace, var_names=[], return_inferencedata=False)
assert len(ppc) == 0
Expand All @@ -641,7 +641,10 @@ def test_normal_scalar(self):
assert ppc["a"].shape == (nchains, ndraws)

# test default case
idata_ppc = pm.sample_posterior_predictive(trace, var_names=["a"])
random_state = self.get_random_state()
idata_ppc = pm.sample_posterior_predictive(
trace, var_names=["a"], random_seed=random_state
)
Comment on lines +645 to +647
Copy link
Member

@ricardoV94 ricardoV94 Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this test requires a seed, the others are not checking anything that depends on the draws. Although passing a seed doesn't hurt, it makes reading the git history less straightforward (unless it was a commit about adding random_seed to all tests, and not just this one in particular).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, removed the seed from all the others.

ppc = idata_ppc.posterior_predictive
assert "a" in ppc
assert ppc["a"].shape == (nchains, ndraws)
Expand Down