-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update expected behavior of
sample
in relation to global seeding.
Together, `test_sample_does_not_set_seed` and `test_parallel_sample_does_not_reuse_seed` covered two unspoken behaviors of `sample`: 1. When no seed is specified, PyMC shall not set global seed state of numpy in the main process. 2. When no seed is specified, sampling will depend on numpy global seeding state for reproducible behavior. Point 1 is due to PyMC legacy dependency on global seeding for step samplers. It tries to minimize "damage" by only setting global seeds when it absolutely needs to, in order to ensure deterministic sampling. Ideally calls to `numpy.seed` would never be made. Point 2 goes against NumPy current best practices of using None when defining new Generators / SeedSequences (https://numpy.org/doc/stable/reference/random/bit_generators/generated/numpy.random.SeedSequence.html#numpy.random.SeedSequence) The refactored tests cover point 1 more directly, and assert the opposite of point 2.
- Loading branch information
1 parent
6956d9b
commit 301912e
Showing
2 changed files
with
38 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters