-
-
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
List more math function in API docs #7211
Conversation
…ithub issue pymc-devs#7130. The first part of the issue was that certain functions like inverse trigonometric functions didn't seem to work, however on a clean install for this commit and pull request, that issue disappeared and the functions work as intended. These functions were missing among others from the website documentation which is the second part of the github issue and is what this particular git commit concerns. Note I have included tround although other codes reflect this as being deprecated but still able to be used. I have also rearranged the ordering to better reflect similar functions being bunched together.
] |
Doc build worked as expected which is good news, does read a bit long so maybe further polish could be doing further category subdivisions like 'Trig functions', 'tensor functions'...etc but this would probably warrant discussion on what good subcategories could be |
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.
Everything looks good, I agree with sorting them into multiple topic related subsections but can be done in a follow up PR
Do all of these functions need to be exposed? I don't think the |
If we expect them to be used they should be somewhere. I am under the impression it is the case, but if it were preferred to use them from pytensor then they can be removed from here and listed on pytensor only. |
My only strong objection is to the numpy ones, because we shouldn't be even suggesting that users use numpy functions on pytensor objects. But I guess this PR is just updating the docs to reflect what functions are already there, so maybe this concern should go in a different thread. |
There is the underlying issue that it isn't really clear what is PyMC's public API, even to team members. But I think this is a good place to discuss that for these functions. Any functions we don't think are public should NOT go into the docs |
Yeah I mean with the pull request I have put forward I just covered all the functions presented in the math.py file just out of sheer completeness since I didn't want to make that executive decision without consultation. I believe I also included 'tround' in the math.rst file for this pull request which is listed as deprecated in math.py but does still work so that one would be another one to possibly put onto the cutting room floor since all it does is raise a deprecation warning and call 'round' anyway |
Let's just show the PyTensor functions and not list the numpy ones. Further refining can be done later. |
Is that something to do on my end? If so is it worth omitting the deprecated 'tround' from the list as well or just the numpy ones? |
You can actually remove the deprecated tround and yes omit the numpy ones |
I actually meant removing the tround code as well |
Ahh I'll do that now, remove the numpy code from math.py too? |
I don't know if the numpy code is being used. Regarding |
If you want (totally optional), you can deprecate the |
Removed tround, replaced round with pytensor.tensor import, and added FutureWarning to log1mexp_numpy and logdiffexp_numpy.
Co-authored-by: Ricardo Vieira <28983449+ricardoV94@users.noreply.github.com>
Co-authored-by: Ricardo Vieira <28983449+ricardoV94@users.noreply.github.com>
Searched PyMC codebase for occurrences of _numpy functions and added explicit warnings. Most of these were for log1mexp_numpy which had quite a few involvements in test codes. Also note that on test_math.py the _numpy functions are explicitly imported and so when deprecated those imports will have to be removed too.
This commit undoes the changes to test_math.py by removing the FutureWarning warnings for the _numpy functions. Note that when these tests are removed the _numpy functions are imported explicitly in this file. Replaced the log1mexp_numpy use in test_continuous.py by just substituting in the maths from the function to avoid calling the function.
@brandonhorsley I pushed a commit that refactors a bit the test code to be more readable. Otherwise I think all is good. Tests are running now |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7211 +/- ##
==========================================
- Coverage 92.23% 91.89% -0.35%
==========================================
Files 100 100
Lines 16889 16884 -5
==========================================
- Hits 15578 15515 -63
- Misses 1311 1369 +58
|
Thanks @brandonhorsley |
Thanks for your help as well @ricardoV94 et al., you've been a big help for getting this first pull request under my belt! |
You're welcome. Looking for your second if that happens! |
Also removes deprecated functions and deprecates numpy helpers Co-authored-by: Ricardo Vieira <ricardo.vieira1994@gmail.com>
Description
This commit is a solution to the problems presented in PyMC github issue #7130. The first part of the issue was that certain functions like inverse trigonometric functions didn't seem to work, however on a clean install for this commit and pull request, that issue disappeared and the functions work as intended. These functions were missing among others from the website documentation which is the second part of the github issue and is what this particular git commit concerns. Note I have included tround although other codes reflect this as being deprecated but still able to be used. I have also rearranged the ordering to better reflect similar functions being bunched together.
Related Issue
Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7211.org.readthedocs.build/en/7211/