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

ENH add h npe #1087

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

ENH add h npe #1087

wants to merge 15 commits into from

Conversation

tomMoral
Copy link
Contributor

What does this implement/fix? Explain your changes

Implement hNPE, from this paper: https://arxiv.org/abs/2102.06477
This PR adds:

  • a hierachical_simulator decorator to wrap simulator and generate simulation with extra observations.
  • a HIerarchicalDensityEstimator which factorizes the posterior and chains two flows to estimate global and local parameters
  • a ``hierarchical_nnhelper to build a flow fromfactory`.

This PR also add an example of use case for this method.

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

From the example:
Without hierarchical observation, with a model $x = \theta_1 \theta_2$, we get ill defined posterior:
image
With 10 extra observation which shares the same $\theta_2$, we get:
image

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
  • 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)

@tomMoral tomMoral changed the title Enh add h npe ENH add h npe Mar 22, 2024
@janfb
Copy link
Contributor

janfb commented Apr 12, 2024

Is this ready for review?

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