-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
pm.sample(random_seed) sets the random_seed of functions from other packages #5714
Comments
Unfortunately (most of) our samplers are dependent on global seeding. It will require a lot of refactoring to overcome that. I am closing this as a duplicate of #5093 |
Thank you @ricardoV94. I'm wondering if a simple "reset" of the seed could occur at the end of a model context block within the function, by setting I was able to do this in a modification of what I had above. The result is
Output. Pymc output omitted for readibility.
|
That would still be problematic, we would be erasing users global seeds if they had set them. AFAICT, a proper solution will require moving away completely from any use of global seeding. We can't make safe assumptions about how users are using global seeding outside of our library. |
OK thank you @ricardoV94. Glad I checked with you before working on my first pymc pull request! |
If you would like to work on this issue it would have a big impact! Even just exploring what needs to be done / possible solutions would be invaluable in itself. |
Thanks. Not sure how much time I can really devote to this, but one thing I thought could be a workaround would be to set the random state back to what it was before. This can, in principle, work, but it also has drawbacks depending on the use case (e.g. my example of running in a loop and calling
Output
In my case, this wouldn't work for me, because I want |
Description of your problem
The
pymc
random_seed
set withinpm.sample
is affecting random function output of other. This is true in all pymc versions I've tested (3.11.0, 3.11.5, 4.0.0b6). I would say that this is unexpected since I would think that the model context would confine parameters within the pymc code block.There's no error but you can see that the
stats.norm.rvs
output repeats itself after the first loop.Removing the
random_seed
or settingrandom_seed=None
does not show this behavior.Versions and main components
The text was updated successfully, but these errors were encountered: