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

Improve default seeds used for each chain #5164

Closed
ricardoV94 opened this issue Nov 9, 2021 · 2 comments
Closed

Improve default seeds used for each chain #5164

ricardoV94 opened this issue Nov 9, 2021 · 2 comments

Comments

@ricardoV94
Copy link
Member

@ColCarroll mentioned that we might want to be more careful with how we seed different chains/processes. Right now this is our default:

random_seed = [np.random.randint(2 ** 30) for _ in range(chains)]

Whereas this seems to be the NumPy recommended strategy: https://numpy.org/doc/stable/reference/random/parallel.html#seedsequence-spawn

I am not sure if this also applies to other places where we create seeds such as in

seed = self.rng_seeder.randint(2 ** 30, dtype=np.int64)

@larryshamalama
Copy link
Member

larryshamalama commented Nov 13, 2021

Upon closer inspection, it seems like NumPy is recommending us to move to Generators instead of RandomStates: https://numpy.org/doc/stable/reference/random/legacy.html?highlight=randomstate#numpy.random.RandomState Should we go from RandomState to Generator, or would this be too much work?

I'm also mentioning this because each SeedSequence can spawn Generator objects and I'm not sure if this would break our code if we were to use their recommended strategy for seeding parallel processes.

@ricardoV94
Copy link
Member Author

This has mostly been done. Further improvements depend on #5797

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants