Change user-facing random variable API#1707
Draft
ricardoV94 wants to merge 3 commits intopymc-devs:mainfrom
Draft
Change user-facing random variable API#1707ricardoV94 wants to merge 3 commits intopymc-devs:mainfrom
ricardoV94 wants to merge 3 commits intopymc-devs:mainfrom
Conversation
8e0488d to
065ce0e
Compare
6b8c5fe to
a5236fc
Compare
a5236fc to
50fa467
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR gets rid of RandomStream, and provides as an alternative random methods on RandomGeneratorType variables.
So one can do:
rng can obviously be a shared variable, and have an update {rng: next_rng}, which is a bit what RandomStream is doing under the hood.
However, everything is now explicit. There are no longer any default_updates, and unlike numpy the user is given the output
next_rngto use afterwards. This is a bit awkward, but it's the most explicit API?The RandomStream had important issues in rewrites, because of the
default_updategraphs are implicit, and when one mutates a graph with such variables they would also need to mutate thedefault_updategraph for the final thing to be correct.RandomVariable Ops will no longer hide the
next_rngoutput like they used to. There's a transition period forcing you to commit to the new flagreturn_next_rng, which will eventually default toTrueif unspecified