Add PyMC code examples to math function docstrings#824
Add PyMC code examples to math function docstrings#824fonnesbeck wants to merge 9 commits intopymc-devs:mainfrom
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.
Import pymc, use pm.math.switch? For a fully reproducible snippet and emphasize math module
There was a problem hiding this comment.
Should we use pm.math or pt, since this is in the pytensor repo?
There was a problem hiding this comment.
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.
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.
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) |
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