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

Parametrize Binomial and Categorical distributions via logit_p #5637

Merged
merged 5 commits into from
Mar 21, 2022

Conversation

purna135
Copy link
Member

Addressing #5005

Parametrized the Binomial and Categorical distributions via logit_p
Added test in test_distributions_random.py

@purna135
Copy link
Member Author

Hi @ricardoV94 and @MarcoGorelli please have a look.

@codecov
Copy link

codecov bot commented Mar 21, 2022

Codecov Report

Merging #5637 (4fba621) into main (e77e238) will increase coverage by 0.43%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5637      +/-   ##
==========================================
+ Coverage   87.64%   88.07%   +0.43%     
==========================================
  Files          76       76              
  Lines       13722    13753      +31     
==========================================
+ Hits        12026    12113      +87     
+ Misses       1696     1640      -56     
Impacted Files Coverage Δ
pymc/distributions/discrete.py 99.73% <100.00%> (+<0.01%) ⬆️
pymc/distributions/simulator.py 87.58% <0.00%> (+0.08%) ⬆️
pymc/sampling.py 88.14% <0.00%> (+2.17%) ⬆️
pymc/step_methods/hmc/quadpotential.py 80.54% <0.00%> (+9.97%) ⬆️

@ricardoV94
Copy link
Member

Looks great. Left a small comment above about the tests

@purna135
Copy link
Member Author

Thank you @ricardoV94, let me fix that

@pymc-devs pymc-devs deleted a comment from purna135 Mar 21, 2022
@ricardoV94
Copy link
Member

Ah and we need a note in the release notes about the new feature!

@purna135
Copy link
Member Author

Okay, I'm not sure what the proper message should be; could you please advise?

@ricardoV94
Copy link
Member

Okay, I'm not sure what the proper message should be; could you please advise?

The easiest is to look at previous entries that are similar for inspiration. I spotted these two:

- Add alternative parametrization to NegativeBinomial distribution in terms of n and p (see [#4126](https://github.com/pymc-devs/pymc/issues/4126))

- Add `logit_p` keyword to `pm.Bernoulli`, so that users can specify the logit of the success probability. This is faster and more stable than using `p=tt.nnet.sigmoid(logit_p)`.

@purna135
Copy link
Member Author

I think, I also forgot to add logit_p to doc string

@purna135
Copy link
Member Author

Done now : )
Please have a look.

@ricardoV94 ricardoV94 merged commit 52682eb into pymc-devs:main Mar 21, 2022
@ricardoV94
Copy link
Member

Thanks for your help @purna135!

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.

None yet

2 participants