-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add Docstrings for pymc.dims.distributions.scalar #8041
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
base: main
Are you sure you want to change the base?
Conversation
|
@ricardoV94, looking forward to your code review. |
pymc/dims/distributions/scalar.py
Outdated
| # Get all subclasses of Continuous class | ||
| imported_dists = { | ||
| name: cls | ||
| for name, cls in inspect.getmembers(_regular_dists, inspect.isclass) | ||
| if issubclass(cls, Continuous) and cls is not Continuous | ||
| } |
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.
Small performance idea: I guess we can get dims_dists first and do a more targetted filter (matches name -> is a subclass of Distribution)?
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.
Done.
|
Seems to work for the docs: https://pymcio--8041.org.readthedocs.build/projects/docs/en/8041/api/dims/generated/pymc.dims.HalfCauchy.html |
524a95c to
1958aaa
Compare
1958aaa to
f480347
Compare
| return super().dist([alpha, beta], **kwargs) | ||
|
|
||
|
|
||
| def create_scalar_dims_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.
Sorry to rethink again.
What if instead we use a decorator on the specific classes or manually do Univariate.__doc__ = foo(regular_dists.Univariate.__doc__)? So we don't need to loop and try to guess what goes with what. This also avoids accidentally overriding custom docstrings if we add them in the future.
Description
This PR (for #7861) adds a function
create_scalar_dims_docstrings()that copies the docstrings from all relevant classes inpymc.distributions.continuoustopymc.dims.distributions.scalar, replacing "tensor_like" with "xtensor_like" where applicable.Related Issue
Checklist
Type of change