-
Notifications
You must be signed in to change notification settings - Fork 129
Add PyMC code examples to math function docstrings #824
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
Conversation
Going to do a few more before merge, if these look good. |
|
||
.. code:: python | ||
|
||
with pm.Model(): |
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.
Import pymc, use pm.math.switch? For a fully reproducible snippet and emphasize math module
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.
Should we use pm.math
or pt
, since this is in the pytensor repo?
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.
Sorry I didn't even realize this was in the pytensor repo. These examples should be in PyMC and in the PyMC math module docs. It doesn't make sense to mention PyMC in PyTensor
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 API docs currently use the docstrings from the PyTensor functions. Do we need to create explicit wrappers in PyMC?
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 can add more stuff in the docs page than the default docstrings I think (or completely override the defaults).
pytensor/tensor/special.py
Outdated
|
||
with pm.Model() as model: | ||
weights = pm.Gamma('weights', 1, 1, shape=3) | ||
softmax_prob = pt.softmax(weights) |
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.
Same
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #824 +/- ##
=======================================
Coverage 80.87% 80.87%
=======================================
Files 163 163
Lines 46852 46852
Branches 11464 11464
=======================================
Hits 37892 37892
Misses 6750 6750
Partials 2210 2210
|
Besides the question of adding PyMC-centric examples, we should definitely scratch the default Elemwise docstrings that we are getting now and which you see when you go to the math module in PyMC. That's just useless gibberish. Mentioned in the understated: #292 |
Might be easiest then to have explicit wrappers to dispatch to PyTensor and override the docstrings. |
Description
Adding usage examples to docstrings
Fixes issue at pymc-devs/pymc#5537
Related Issue
Checklist
Type of change