-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Refactor of Sequential Monte Carlo internals #5274
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
Refactor of Sequential Monte Carlo internals #5274
Conversation
ciguaran
commented
Dec 21, 2021
- This is my first PR ever to Pymc.
- There should not be any breaking changes. This PR modularizes a little bit SMC internals.
- This is an initial refactor, that adds documentation and makes it easier for a new reader to find where the actual SMC sampling happens, vs what checks/stats are generated.
- Maybe some reviewer can answer the question in the comment line 86 from test_smc.
@aloctavodia FYI |
|
||
assert_random_state_equal( | ||
initial_rng_state, np.random.get_state() | ||
) # TODO: why this? maybe to verify that nothing was sampled? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR where this test was added provides some context: #5131
Since it was not obvious why it was there, a comment before the assert explaining the purpose of the check could be helpful.
@@ -0,0 +1,51 @@ | |||
import multiprocessing as mp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this needs to be in its own separate file. The original file is pretty concise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I didn't extracted due to size, but because it feels that running parallel vs sequential is kind of independent of SMC, and that it could be reused somewhere else. LMK if its enough reason to be outside or I move it again in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a similar need emerges on another sampler we can refactor it then. Doing it now seems like some premature refactoring.
Also it wouldn't make sense to host it inside the SMC module
@ciguaran Thanks for opening the PR. I left some comments above. Since the purpose of this PR is just to clean things out a bit, it would be useful if the commit history is also cleaned up, so that we don't mix changes that have different purposes (like tests doc-strings vs internal refactoring). There is a guide here that might provide some help: https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes |
cool, do you prefer me to squash commits or create a new PR? |
You can try the first, it's a good practice. If it fails miserably you can always open a new PR |
Closing to fix commit messages easily, please look at #5281 instead |