Skip to content

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

Closed

Conversation

ciguaran
Copy link
Contributor

  • 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.

@ciguaran
Copy link
Contributor Author

@aloctavodia FYI


assert_random_state_equal(
initial_rng_state, np.random.get_state()
) # TODO: why this? maybe to verify that nothing was sampled?
Copy link
Member

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
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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

@ricardoV94
Copy link
Member

@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

@ricardoV94 ricardoV94 added SMC Sequential Monte Carlo maintenance labels Dec 21, 2021
@ciguaran
Copy link
Contributor Author

@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?

@ricardoV94
Copy link
Member

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

@ciguaran
Copy link
Contributor Author

ciguaran commented Dec 22, 2021

Closing to fix commit messages easily, please look at #5281 instead

@ciguaran ciguaran closed this Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance SMC Sequential Monte Carlo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants