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

Fix bug in importance sampled posterior #1081

Merged
merged 4 commits into from
Apr 2, 2024
Merged

Fix bug in importance sampled posterior #1081

merged 4 commits into from
Apr 2, 2024

Conversation

max-dax
Copy link
Contributor

@max-dax max-dax commented Mar 21, 2024

What does this implement/fix? Explain your changes

When running importance sampling with sir, ImportanceSamplingPosterior._sir_sample used the wrong kwarg for oversampling_factor when calling the sir function, such that this function always ran with a default oversampling_factor of 32.

Does this close any currently open issues?

Fixes # (issue)

Any relevant code examples, logs, error output, etc?

...

Any other comments?

...

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.

  • I have read and understood the contribution
    guidelines
  • I agree with re-licensing my contribution from AGPLv3 to Apache-2.0.
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works => see Importance sampling tutorial #1080
  • I have reported how long the new tests run and potentially marked them
    with pytest.mark.slow.
  • New and existing unit tests pass locally with my changes
  • I performed linting and formatting as described in the contribution
    guidelines
  • I rebased on main (or there are no conflicts with main)

@max-dax max-dax requested a review from michaeldeistler March 21, 2024 16:30
Copy link
Contributor

@janfb janfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this 🙏
This PR also contains the tutorial. Shall we close #1080 then and do both in this PR?

@@ -253,7 +253,7 @@ def _sir_sample(
self.potential_fn,
proposal=self.proposal,
num_samples=num_samples,
oversampling_factor=oversampling_factor,
num_candidate_samples=oversampling_factor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@max-dax
Copy link
Contributor Author

max-dax commented Mar 25, 2024

This PR also contains the tutorial. Shall we close #1080 then and do both in this PR?

Yes, I have close #1080.

Copy link
Contributor

@michaeldeistler michaeldeistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @max-dax!

@michaeldeistler michaeldeistler merged commit d3b458b into main Apr 2, 2024
3 checks passed
@michaeldeistler michaeldeistler deleted the fix_sir_bug branch April 2, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants