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

Add a Gibbs sampler for the Horseshoe prior and a Polya-gamma normal scale-mixture expansion #1

Merged
merged 1 commit into from
Dec 30, 2021

Conversation

zoj613
Copy link
Member

@zoj613 zoj613 commented Dec 23, 2021

This PR adds functions for creating sampler steps for a normal regression under a Horseshoe prior as described in "A Simple Sampler for the Horseshoe Estimator" (Makalic, Enes & Schmidt, Daniel, 2015).
It also implements the Polya-gamma normal scale mixture expansion described in "Data Augmentation for Non-Gaussian Regression Models Using Variance-Mean Mixtures" (Polson, Nicholas G., and James G. Scott, 2013) and the multivariate normal sampler in "Fast Simulation of Hyperplane-Truncated Multivariate Normal Distributions" (Cong, Yulai, Bo Chen, and Mingyuan Zhou, 2017).

@zoj613 zoj613 force-pushed the negbinom_horseshoe branch 3 times, most recently from ae0afc9 to e1bdbac Compare December 23, 2021 22:33
@brandonwillard brandonwillard added enhancement New feature or request important labels Dec 23, 2021
@brandonwillard brandonwillard self-requested a review December 23, 2021 23:07
@zoj613 zoj613 marked this pull request as ready for review December 24, 2021 10:59
@zoj613 zoj613 marked this pull request as draft December 24, 2021 10:59
@zoj613 zoj613 force-pushed the negbinom_horseshoe branch 2 times, most recently from 5d6d049 to 7f27650 Compare December 24, 2021 11:57
Copy link
Member

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

Looks great!

I just added a few comments about general refactoring. If you don't mind rebasing, I can make those changes to this branch.

Otherwise, we need to get the coverage working on this repo so we can make sure that checks out, and we can continue to iterate on MCMC/model-level testing. We could also just merge this after coverage checks out and iterate in follow-ups.

@brandonwillard brandonwillard marked this pull request as ready for review December 24, 2021 19:35
@brandonwillard brandonwillard force-pushed the negbinom_horseshoe branch 2 times, most recently from 155f034 to 72cb9c6 Compare December 24, 2021 20:45
@codecov
Copy link

codecov bot commented Dec 24, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@276117d). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 752e701 differs from pull request most recent head 0f5e947. Consider uploading reports for the commit 0f5e947 to get more accurate results
Impacted file tree graph

@@           Coverage Diff            @@
##             main        #1   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         2           
  Lines           ?        99           
  Branches        ?         6           
========================================
  Hits            ?        99           
  Misses          ?         0           
  Partials        ?         0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 276117d...0f5e947. Read the comment docs.

Copy link
Member

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

OK, I pushed those refactoring changes. Now, we should try to do one other: separate the Horseshoe and Polya-gamma sampler steps.

In other words, we could have helper functions that generate sampler steps for each independently, then we can provide one that combines the two. This allows people to generate Polya-gamma scale-mixture samplers and normal Horseshoe samplers independently. Plus, it will serve as the basis for us to automate the creation of Horseshoe samplers for a wide variety of known scale mixtures.

Also, we need to set up some tests specifically for the PolyaGammaRV in a test_dists.py. Those tests can be really simple, though, because the implementation is just a pass-through to polyagamma. For that matter, it could be just a single test.

@brandonwillard brandonwillard changed the title Add a gibbs sampling function for the HorseShoe negative Binomial reg… Add a Gibb sampler for the Horseshoe prior and a Polya-gamma normal scale-mixture expansion Dec 24, 2021
@brandonwillard brandonwillard changed the title Add a Gibb sampler for the Horseshoe prior and a Polya-gamma normal scale-mixture expansion Add a Gibbs sampler for the Horseshoe prior and a Polya-gamma normal scale-mixture expansion Dec 24, 2021
@zoj613 zoj613 force-pushed the negbinom_horseshoe branch 6 times, most recently from da6a5aa to 9c0b301 Compare December 29, 2021 12:30
Copy link
Member

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

This is looking great. I added some minor comments, but, aside from those, we can merge this after squashing.

@zoj613 zoj613 force-pushed the negbinom_horseshoe branch from 752e701 to 0e7382e Compare December 30, 2021 09:26
@zoj613
Copy link
Member Author

zoj613 commented Dec 30, 2021

@brandonwillard i've squashed the commits and addressed the comments made.

@zoj613 zoj613 force-pushed the negbinom_horseshoe branch from 0e7382e to 0f5e947 Compare December 30, 2021 09:29
@zoj613 zoj613 merged commit 5edcecd into aesara-devs:main Dec 30, 2021
@zoj613 zoj613 deleted the negbinom_horseshoe branch December 30, 2021 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request important
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants