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

Use local random state #400

Open
yannikschaelte opened this issue Jan 22, 2021 · 1 comment
Open

Use local random state #400

yannikschaelte opened this issue Jan 22, 2021 · 1 comment

Comments

@yannikschaelte
Copy link
Member

It is cleaner to manually define a random state, pass it to pyabc and then also to all workers (appropriately reinitialized). This would allow increasing the degree of reproducibility (there was an issue on that ...) and complies with numpy's new recommendations. https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html.

Suggest in addition allowing to pass a simple id resulting in a default Mersenne or whatever random number generator.
TBD: What if the random package is used.

Also add documentation on seeding.

@JohnGoertz
Copy link

Just to comment here, that using numpy's new SeedSequence and "spawning" seeds for each worker from that parent would probably be better than using np.random.randint() to generate the new seed for each worker. See these recommendations for "Parallel Random Number Generation" from Numpy: https://numpy.org/doc/stable/reference/random/parallel.html.

Alternatively, you can just rewrite the whole thing with JAX, and then you'll be forced to be reproducibly random 😏

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

3 participants