-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Check that concentration parameters of Dirichlet distribution are all > 0 #3853
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3853 +/- ##
==========================================
- Coverage 90.69% 90.39% -0.31%
==========================================
Files 135 135
Lines 21190 21202 +12
==========================================
- Hits 19219 19165 -54
- Misses 1971 2037 +66
|
I'm not sure I understand CodeCov output here: does this mean I have to modify something in all of the mentioned "Impacted files"? |
Does it work if the input is a RV? |
This looks like just a buggy report. I wouldn't worry. |
(note: thomas' question is still a good one) |
Thanks @ColCarroll -- kind of a relief 😅 |
Yes, exactly. |
The condition I added to check strict positiveness is only for arrays -- so no; I should add this case. I suppose positiveness is already taken care of; I just have to figure out how to add the "strict" 😉 |
Still getting esoteric CodeCov warnings, but the tests passed 🎉 |
@AlexAndorra A test would be good. |
Is think there already are tests, aren't there? In |
@AlexAndorra Apparently not of passing in negative values, otherwise that test would have failed I think. |
Ow ok -- sorry I'm not well versed in testing. |
|
Thanks guys, this was very helpful! |
Thanks! |
As dicussed with @junpenglao, the Dirichlet distribution doesn't check that the concentration parameters (
a
vector) are all strictly positive when the distribution is initialized.Currently, the user can define
pm.Dirichlet("p", a=np.array([-1, 2, 3]), shape=3)
in a model and PyMC won't complain before the user tries to sample from the model (BadInitialEnergy Error
).As the concentration parameters have to be > 0, this PR just checks that it is the case before the user can do anything else.
Thanks in advance for the review, and I'm there for any comment/change. PyMCheers ✌️