Skip to content

fix: rejection posterior should use theta_transform#1827

Merged
manuelgloeckler merged 3 commits intomainfrom
fix-rejection-posterior
Mar 31, 2026
Merged

fix: rejection posterior should use theta_transform#1827
manuelgloeckler merged 3 commits intomainfrom
fix-rejection-posterior

Conversation

@janfb
Copy link
Copy Markdown
Contributor

@janfb janfb commented Mar 27, 2026

bug: RejectionPosterior was not using a theta_transform when sampling with a constrained prior. This is fixed in this PR by removing the optional kwarg in the RejectionPosteriorParameters config class and instead passing it on during build_posterior by default and also using it when sampling with reject_outside_prior=True.

related to #1718

@janfb janfb requested a review from manuelgloeckler March 27, 2026 13:51
@janfb janfb mentioned this pull request Mar 27, 2026
3 tasks
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (49fa029) to head (6e8adbb).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1827      +/-   ##
==========================================
+ Coverage   87.95%   87.99%   +0.03%     
==========================================
  Files         140      140              
  Lines       12795    12985     +190     
==========================================
+ Hits        11254    11426     +172     
- Misses       1541     1559      +18     
Flag Coverage Δ
fast 82.77% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sbi/inference/posteriors/posterior_parameters.py 83.73% <ø> (+0.40%) ⬆️
sbi/inference/posteriors/rejection_posterior.py 78.18% <ø> (ø)
sbi/inference/trainers/base.py 94.10% <ø> (ø)

... and 1 file with indirect coverage changes

Copy link
Copy Markdown
Contributor

@manuelgloeckler manuelgloeckler 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!

Not sure why, but one test on signatures fail posterior_parameters_test which checks for theta_transform but this got removed herein so the test should be adapted before merging.

Edit: I fixed it.

@manuelgloeckler manuelgloeckler merged commit c8fac87 into main Mar 31, 2026
9 checks passed
@janfb janfb deleted the fix-rejection-posterior branch March 31, 2026 15:05
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.

2 participants