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

Implement Resamper for interactive prior tuning #3118

Merged
merged 17 commits into from
Jul 25, 2022
Merged

Conversation

fritzo
Copy link
Member

@fritzo fritzo commented Jul 18, 2022

This implements an importance resampler as a computational aid for interactively tuning prior predictive samples early in ones Bayesian workflow.

Additional work

  • Support multiple distributions. This seems complex.
  • Add notebook that uses ipywidgets with some sliders to show to quickly visualize prior predictives.

Tested

new tests complete in <0.1sec on my machine

  • Added moment-checking test

Open in Colab, you'll need to replace the pip install line with:

!pip install -q https://github.com/pyro-ppl/pyro/archive/resample-cache.zip

@@ -92,7 +92,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"
Copy link
Member Author

Choose a reason for hiding this comment

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

this silences a new sphinx warning

@martinjankowiak
Copy link
Collaborator

happy to review but will need a walk-through

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@fritzo
Copy link
Member Author

fritzo commented Jul 20, 2022

@martinjankowiak sure I'd be happy to walk you through over zoom some evening. I've also added a notebook if you want to run that locally. The algorithm is cute, but the interface seems awkward, lying somewhere between Distributions and models. Advice welcome.

@fritzo fritzo changed the title Implement ResamplingCache for interactive prior tuning Implement Resamper for interactive prior tuning Jul 21, 2022
@fritzo
Copy link
Member Author

fritzo commented Jul 21, 2022

ok, I've simplified and improved the interface to use a more idiomatic (model,guide) pair.

@martinjankowiak
Copy link
Collaborator

notebooks typos:

  • ensmble
  • 'particular values top level latent' => +of

pyro/infer/resampler.py Show resolved Hide resolved
pyro/infer/resampler.py Outdated Show resolved Hide resolved
@martinjankowiak martinjankowiak merged commit cdea256 into dev Jul 25, 2022
@martinjankowiak martinjankowiak deleted the resample-cache branch July 25, 2022 22:43
OlaRonning pushed a commit to aleatory-science/pyro that referenced this pull request Aug 2, 2022
* Implement ResamplingCache

* Vectorize for speed

* lint

* optimization nit

* More optimization

* Completely vectorize

* Generalize to multiple distributions

* Add a tutorial

* Refactor to use models

* Simplified, but introduced a bug 😕

* fix bug

* Update tutorial

* Implement stable sampling via Gumbel-max trick

* Change nomenclature

* Update prior_predictive.ipynb

Fix colab link

* Install pyro-ppl in colab

* Address review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants