-
-
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
Remove wrong type-hints and stale docstrings from distributions #6280
Remove wrong type-hints and stale docstrings from distributions #6280
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6280 +/- ##
==========================================
+ Coverage 94.19% 94.59% +0.40%
==========================================
Files 102 111 +9
Lines 21490 25883 +4393
==========================================
+ Hits 20243 24485 +4242
- Misses 1247 1398 +151
|
Thank you Ricardo! I'll get to this in next 96 hours |
Not blocking the PR, but trying to think forawrd. How do we expect users to know what parameters they need to pass for logp/logcdf to work? several distributions also have alternative parametrizations |
Users should never call these methods themselves. The user-facing API is |
Ah this is where I think you and I saw things differently. These are forms of developer documentation for me so if someone is contributing code in the future this is for them. For instance a number of these docstrings would be useful to me right now as a contributor if these methods needed to change. Thats why Im trying to save them (in some form!) |
I would bet a newbie developer would be more confused than enlightened by these broken docstrings... |
values are desired the values must be provided in a numpy array or Aesara tensor. | ||
mu : tensor_like of float | ||
Mean of the distribution (mu > 0). | ||
lam : tensor_like of float |
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.
This is a really good example. I wouldnt know what lam or alpha are by memory and from the logp calculation below theres not enough math to tell me. Having even just a basic description of the parameters would be helpful mathematically.
The other is the what is allowed as inputs. If I was to write code that called this logp I would know what to pass, and auto type checking would be useful.
In the scope of things I care way more about 1 than I do 2, though both would be nice
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.
This is a really good example of why I don't like it. The return type is completely wrong, should be TensorVariable (Type) not RandomVariable (Op). Also we only test and promise to support TensorVariable inputs, not float or np.ndarray (even though many times they will work)
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.
The parameter information is contained in the main distribution docstring already.
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.
pymc/pymc/distributions/continuous.py
Lines 861 to 868 in d34b557
mu : tensor_like of float, optional | |
Mean of the distribution (mu > 0). | |
lam : tensor_like of float, optional | |
Relative precision (lam > 0). | |
phi : tensor_like of float, optional | |
Alternative shape parameter (phi > 0). | |
alpha : tensor_like of float, default 0 | |
Shift/location parameter (alpha >= 0). |
Ok, presumably with the pin in #6282, mypy is now passing. Is this ready to merge? (I have not reviewed.) |
Related to #4859
This was originally proposed in #6272, see #6272 (review)
Major / Breaking Changes
Bugfixes / New features
Docs / Maintenance
logp
andlogcdf
docstrings