bambinos / bambi

BAyesian Model-Building Interface (Bambi) in Python.
https://bambinos.github.io/bambi/
MIT License
1.06k stars 121 forks source link

Adding Horseshoe Prior #836

Closed julianlheureux closed 4 weeks ago

julianlheureux commented 1 month ago

Hello! In this pull request, I added the horseshoe prior to the dictionary where Bambi stores specific prior distributions.

This is Carvalho's horseshoe prior, designed for the coefficients of a multiple regression model with a large number of explanatory variables, where only a few are statistically significant.

review-notebook-app[bot] commented 1 month ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

tomicapretto commented 1 month ago

@julianlheureux thanks for the contribution! This is something we wanted for a long time.

Before merging, it would be nice to add a test. I imagine the following would be OK as it covers the basic use cases:

In both tests I would check that

I would not check for the absence of divergences, etc. because we can't guarantee they won't happen.

I know the PyMC part of the tests is not trivial as one has to interact with PyMC internals. So, if you want you can get started with the test and I can share a snippet showing how to test that.

tomicapretto commented 4 weeks ago

Thanks @julianlheureux!

There's something happening with the tests, but that's unrelated to the code contribution. It has to be with data loading.