-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
Shaunagm/bugfix/discrete #3211
Shaunagm/bugfix/discrete #3211
Conversation
This PR replaces gh-3195. |
@@ -1513,7 +1513,7 @@ def pdf(self, x, *args, **kwds): | |||
if any(cond): | |||
goodargs = argsreduce(cond, *((x,)+args+(scale,))) | |||
scale, goodargs = goodargs[-1], goodargs[:-1] | |||
place(output, cond, self._pdf(*goodargs) / scale) | |||
place(output, cond, np.clip(self._pdf(*goodargs) / scale, 0, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for continuous distributions, pdf is the probability density rather than a probability itself, it does not need to be in [0, 1].
Removed the changes to pdf, and rebased the commits while I was at it so the commit history's cleaner. I also added a working test but when running the suite, I found 8 failures apparently induced by the clipping changes. |
Sorry for a delay. The test failures I see are twofold:
(notice the use of |
I've made your suggested changes, which allowed the tests to pass. I'm curious what thought process led you to "drop clipping for cdf and sf for continuous distributions" rather than "test vonmises separately"? Is there a general preference to, within broad categories, treat distributions the same? |
This isn't about testing, this is about not breaking the previous behavior: If you then plot vonmises.cdf, you'll see that it's not confined to [0, 1]. Then, test_vonmises_periodic tests periodicity of cdf modulo one. So, the previous behavior is to have vonmises distribution to have unbounded support and a special trick to get a proper cdf. Just clipping it would break the established behavior and this is undesirable. |
Merged it, thanks @shaunagm! |
No description provided.