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 BernoulliLogit #1623

Merged
merged 4 commits into from
Nov 8, 2022
Merged

Add BernoulliLogit #1623

merged 4 commits into from
Nov 8, 2022

Conversation

devmotion
Copy link
Member

This PR adds a Bernoulli distribution with the logit of the success rate as parameter.

This is motivated by use cases e.g. in Turing (TuringLang/Turing.jl#1890) where it is more convenient to work with unconstrained parameters. First class support for the parameterization allows us to evaluate e.g. the log pdf more efficiently.

@mschauer
Copy link
Member

mschauer commented Oct 5, 2022

Can you mention “parametrized by the log of the odds Logitp = p/(1-p)” in the docstring

@devmotion devmotion changed the title [WIP] Add BernoulliLogit Add BernoulliLogit Oct 9, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2022

Codecov Report

Base: 85.94% // Head: 85.50% // Decreases project coverage by -0.44% ⚠️

Coverage data is based on head (9ed9c73) compared to base (4c27f7d).
Patch coverage: 12.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1623      +/-   ##
==========================================
- Coverage   85.94%   85.50%   -0.45%     
==========================================
  Files         129      130       +1     
  Lines        8098     8155      +57     
==========================================
+ Hits         6960     6973      +13     
- Misses       1138     1182      +44     
Impacted Files Coverage Δ
src/Distributions.jl 100.00% <ø> (ø)
src/univariates.jl 74.07% <ø> (ø)
src/univariate/discrete/bernoullilogit.jl 12.00% <12.00%> (ø)
src/univariate/continuous/skewnormal.jl 65.62% <0.00%> (ø)
src/eachvariate.jl 90.47% <0.00%> (+4.76%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@devmotion
Copy link
Member Author

Can you mention “parametrized by the log of the odds Logitp = p/(1-p)” in the docstring

Are you interested in the term "log-odds" specifically? The docstring already mentions that it is parameterized by the logit of the success rate, and log-odds is just another name for the logit (see e.g. https://en.wikipedia.org/wiki/Logit).

@devmotion devmotion marked this pull request as ready for review October 10, 2022 08:12
@devmotion
Copy link
Member Author

Generally this PR should be ready and well-tested.

@matbesancon
Copy link
Member

should be good to merge when tests pass I think

@mschauer
Copy link
Member

mschauer commented Oct 16, 2022

The docstring already mentions that it is parameterized by the logit of the success rate

Well, that requires you knowing what a logit is. Saying it is "parametrised by logitp = log(p/(1-p)) where p is the success rate" makes everything immediately clear to the passerby - doesn't it?

@devmotion
Copy link
Member Author

Ah I see, I thought the main point of your comment was the term log odds. I changed the docstring, hopefully it is clearer now.

@devmotion devmotion merged commit 9a544d9 into master Nov 8, 2022
@devmotion devmotion deleted the dw/bernoullilogit branch November 8, 2022 08:40
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.

4 participants