Skip to content

feat: base conditional estimator class - #1151

Merged
manuelgloeckler merged 14 commits into
mainfrom
966-estimator-abstractions
Jun 14, 2024
Merged

manuelgloeckler merged 14 commits into
mainfrom
966-estimator-abstractions

Conversation

@manuelgloeckler

@manuelgloeckler manuelgloeckler commented Apr 29, 2024 •

Copy link
Copy Markdown
Contributor

What does this implement/fix? Explain your changes

Implements an abstract base class for estimators, which has:

  • input_shape
  • condition_shape
  • abstract loss function.

Does this close any currently open issues?

Will close #966.
Will replace #1072 .

Considerations:

  • Density estimator sample and log_prob could be abstract methods, instead of raising a NotImplementedError

@manuelgloeckler manuelgloeckler linked an issue Apr 29, 2024 that may be closed by this pull request
@codecov

codecov Bot commented Apr 29, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 67.85714% with 18 lines in your changes missing coverage. Please review.

Project coverage is 72.90%. Comparing base (1b268b8) to head (483ad93).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1151       +/-   ##
===========================================
- Coverage   83.08%   72.90%   -10.18%     
===========================================
  Files          92       93        +1     
  Lines        7259     7397      +138     
===========================================
- Hits         6031     5393      -638     
- Misses       1228     2004      +776     
Flag Coverage Δ
unittests 72.90% <67.85%> (-10.18%) ⬇️

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

Files Coverage Δ
sbi/inference/posteriors/direct_posterior.py 98.36% <100.00%> (ø)
...inference/potentials/likelihood_based_potential.py 100.00% <100.00%> (ø)
.../inference/potentials/posterior_based_potential.py 97.05% <100.00%> (ø)
sbi/inference/snle/snle_base.py 93.61% <100.00%> (ø)
sbi/inference/snpe/snpe_base.py 89.02% <100.00%> (ø)
sbi/neural_nets/__init__.py 100.00% <100.00%> (ø)
sbi/neural_nets/density_estimators/__init__.py 100.00% <100.00%> (ø)
.../neural_nets/density_estimators/categorical_net.py 98.03% <100.00%> (ø)
...nets/density_estimators/mixed_density_estimator.py 69.11% <100.00%> (ø)
sbi/neural_nets/density_estimators/nflows_flow.py 63.46% <100.00%> (ø)
... and 3 more

... and 25 files with indirect coverage changes

@janfb janfb mentioned this pull request Jun 3, 2024
2 of 6 tasks

@tomMoral tomMoral 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.

It looks quite good! A few comment, feel free to ignore some if it is too much nitpicks.

@manuelgloeckler

Copy link
Copy Markdown
Contributor Author

Great, thanks for the review and suggested changes :)

I think it actually also would be more appropriate to adapt the naming to:

  • Estimator -> ConditionalEstimator
  • DensityEstimator -> ConditionalDensityEstimator

What do you think?

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

Thanks a lot for these changes!

I added a couple of comments and questions. Happy to discuss in person if needed.

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

Thanks for adding the fixes. Looks all great now!

@janfb janfb changed the title Base estimator class feat: base conditional estimator class Jun 13, 2024
@manuelgloeckler
manuelgloeckler merged commit 8efb8e4 into main Jun 14, 2024
@janfb janfb mentioned this pull request Jun 18, 2024
@janfb
janfb deleted the 966-estimator-abstractions branch June 20, 2024 10:34
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.

Estimator abstractions

3 participants