Skip to content

Fix 921 SNLE SNRE code duplication - #954

Merged
janfb merged 4 commits into
mainfrom
921-snle-snre-code-duplication
Feb 23, 2024
Merged

janfb merged 4 commits into
mainfrom
921-snle-snre-code-duplication

Conversation

@jsvetter

@jsvetter jsvetter commented Feb 21, 2024 •

Copy link
Copy Markdown
Contributor

Fix for #921.

Moved append_simulations to base.py. There is some method specific arguments given to the nle_nre_apt_msg_on_invalid_x function, but purely for logging.

So I added an algorithm argument in base.py and overwite it for the specific method in the super() call.

The nle_nre_apt_msg_on_invalid_x function makes append_simulations specific to SLNE, SNRE. So an alternative would be to have an intermediate object between NeuralInference and the estimators to make this clear?

@janfb janfb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thank a lot for addressing this @jsvetter 🙏

added a couple of comments.

Comment thread sbi/inference/base.py Resolved
Comment thread sbi/inference/base.py Resolved
Comment thread sbi/inference/base.py Resolved
@jsvetter
jsvetter requested a review from janfb February 21, 2024 12:58

@janfb janfb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good, thanks!

@michaeldeistler michaeldeistler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Small comment below, but feel free to merge.

Comment thread sbi/inference/snle/snle_base.py Resolved
@janfb

janfb commented Feb 22, 2024

Copy link
Copy Markdown
Contributor

pyright is failing because of vi_flows type issues.
pytest is passing locally, so it is safe to merge this.

@janfb
janfb force-pushed the 921-snle-snre-code-duplication branch from 366b7c6 to d9be24b Compare February 23, 2024 09:30
@codecov

codecov Bot commented Feb 23, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.04%. Comparing base (ee7e9a3) to head (d9be24b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #954      +/-   ##
==========================================
- Coverage   76.09%   76.04%   -0.05%     
==========================================
  Files          80       80              
  Lines        6341     6329      -12     
==========================================
- Hits         4825     4813      -12     
  Misses       1516     1516              
Flag Coverage Δ
unittests 76.04% <100.00%> (-0.05%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@janfb
janfb merged commit b856c07 into main Feb 23, 2024
@janfb
janfb deleted the 921-snle-snre-code-duplication branch February 23, 2024 09:59
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.

code duplication: SNLE and SNRE have identical append_simulations methods.

3 participants