-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ChiSquared now returns a Gamma random variable #7007
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
ChiSquared now returns a Gamma random variable #7007
Conversation
pymc/distributions/continuous.py
Outdated
return _logcdf_helper(Gamma.dist(alpha=nu / 2, beta=0.5), value) | ||
@classmethod | ||
def dist(cls, nu, **kwargs): | ||
return CustomDist.dist( |
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.
We don't need a CustomDist, we can return Gamma directly since it's just a parametrization not a variable transformation.
That mean we need a __new__
method as well
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.
I went with this route as the suggested makes the __repr__
says its just a Gamma distribution. I thought itd be good to display a different name. I can go with your suggestion if you disagree
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.
We shouldn't create a new object, indeed it's just a gamma. We can even state so in the docstrings
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.
Where in the docs? I'm just seeing the pdf https://www.pymc.io/projects/docs/en/stable/api/distributions/generated/pymc.ChiSquared.html
I will add this relationship in the docstring under the class
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.
Wr should also remove the RV from PyTensor and use only a helper there
sounds good. I will take a look |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #7007 +/- ##
==========================================
- Coverage 92.19% 91.39% -0.80%
==========================================
Files 101 101
Lines 16921 16955 +34
==========================================
- Hits 15600 15496 -104
- Misses 1321 1459 +138
|
I'm interpreting the tests as ones that needs to be removed. For instance, only the The other is for the rewrite which wouldn't be supported anymore through that chisquare |
Just make it use |
All of the |
ChiSquared
helper
What is this PR about?
Closes #6994
Checklist
Major / Breaking Changes
New features
Bugfixes
Documentation
Maintenance
📚 Documentation preview 📚: https://pymc--7007.org.readthedocs.build/en/7007/