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

Integrate new density estimator interface into SBI #957

Closed
7 tasks
manuelgloeckler opened this issue Feb 27, 2024 · 6 comments
Closed
7 tasks

Integrate new density estimator interface into SBI #957

manuelgloeckler opened this issue Feb 27, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request hackathon

Comments

@manuelgloeckler
Copy link
Contributor

manuelgloeckler commented Feb 27, 2024

Description

Following #952 we need to integrate the new Density Estimator class into SBI

Checklist

Following steps:

  • 1) Change posterior_nn helper function to return the new Density Estimator class
  • 2) Change likelihood_nn helper function to return the new Density Estimator class
  • 3) Change classifier_nn helper function to return ( new Ratio Estimator Class ?)
  • 4) Integrate new interface into SNPE base classes.
  • 5) Integrate new interface into SNLE base classes.
  • 6) Integrate new interface into SNRE base classes.
  • 7) Try out a new density estimator i.e. from ZUKO.

These steps can be worked on almost in parallel.

@manuelgloeckler
Copy link
Contributor Author

@gmoss13 I will start with 1) posterior_nn and 4) integration into SNPE base classes.

@gmoss13
Copy link
Contributor

gmoss13 commented Feb 28, 2024

Thanks for setting up the issue! I will begin with 2) likelihood_nn and 5) integration into SNLE base classes.

@manuelgloeckler
Copy link
Contributor Author

Actually, looking into it a bit: I think DensityEstimator needs to expose a few functions from torch.nn.Module. For instance, for any training method, we would need:

  • parameters: To get all the parameters to optimize.
  • to: To move tensors to device
  • train: To switch to train mode
  • eval: To switch to eval mode.
  • zero_grad: (optional) But currently used in SNPE base training

The easiest would be to make "DensityEstimator" or any general "Estimator" a subclass of nn.Module.

@janfb
Copy link
Contributor

janfb commented Feb 28, 2024

I like the idea with nn.Module 👍 this makes it easier to integrate things with PPL frameworks as well.

@gmoss13
Copy link
Contributor

gmoss13 commented Mar 7, 2024

  • 3) Change classifier_nn helper function to return ( new Ratio Estimator Class ?)

Thinking about this some more, not sure how necessary this is? Currently only ratio estimators (I am aware of) are through classifiers, for which we just use nn.Modules directly. I'm not sure what would be added by adding a RatioEstimator wrapper.

  • 6) Integrate new interface into SNRE base classes.

This would only be necessary if we do 3.

@gmoss13
Copy link
Contributor

gmoss13 commented Mar 24, 2024

Closing this in favour of #992 as everything else is addressed already.

@gmoss13 gmoss13 closed this as completed Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hackathon
Projects
None yet
Development

No branches or pull requests

3 participants