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

Adding default priors for Binomial/Bernoulli families with logit link #830

Merged
merged 19 commits into from
Aug 22, 2024

Conversation

julianlheureux
Copy link
Contributor

Hello! I am working on improving default priors.

Starting with some small steps, I did some examples of logistic regression models with logit link. Linear predictor for weakly informative priors should be within -5 and 5. So I tried to improve the prior scaler, with some conditionals looking for these cases.

Setting the intercept prior to N(0,1.5), and common terms to N(0, 1/sd(x_i)). When using categoric variables, priors will be set to N(0,1).

Doing these changes, we arrive to weakly informative priors (at least, better than the originals).

@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 74.07407% with 7 lines in your changes missing coverage. Please review.

Project coverage is 89.82%. Comparing base (4cc3103) to head (c06ce1a).
Report is 6 commits behind head on main.

Files Patch % Lines
bambi/priors/scaler.py 74.07% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #830      +/-   ##
==========================================
- Coverage   90.01%   89.82%   -0.20%     
==========================================
  Files          47       47              
  Lines        3967     3991      +24     
==========================================
+ Hits         3571     3585      +14     
- Misses        396      406      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tomicapretto
Copy link
Collaborator

Hi @julianlheureux, thanks a lot for the contribution and sorry for the delay in the review.

Could you also re-run a few of the examples using the affected families so the docs are also updated? With that, I think we could merge this.

bambi/priors/scaler.py Outdated Show resolved Hide resolved
bambi/priors/scaler.py Show resolved Hide resolved
@julianlheureux
Copy link
Contributor Author

Hello! I think I successfully made the changes you highlighted.
Please let me know if there's anything else in the code that needs improvement.

Copy link
Collaborator

@tomicapretto tomicapretto left a comment

Choose a reason for hiding this comment

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

Hi Julián, thanks for changes. I just suggested a few extra comments.

Co-authored-by: Tomás Capretto <tomicapretto@gmail.com>
Copy link
Contributor Author

@julianlheureux julianlheureux left a comment

Choose a reason for hiding this comment

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

I think the comments are appropriate! Thanks for helping make the code clearer and cleaner!

But there is a problem with the comments. There are some tests that fail becouse the line with the comment is too long. We have to make this shorter...

@tomicapretto
Copy link
Collaborator

@julianlheureux I see everything green now, so I assume you fixed the issue related to the comment length, right?

@julianlheureux
Copy link
Contributor Author

@julianlheureux I see everything green now, so I assume you fixed the issue related to the comment length, right?

I think i managed to fix it. If you want, you can check the changes in the last commits I made, making those lines shorter.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tomicapretto tomicapretto merged commit e7b079d into bambinos:main Aug 22, 2024
4 checks passed
@julianlheureux julianlheureux deleted the change_priors branch August 22, 2024 14:33
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.

3 participants