-
-
Notifications
You must be signed in to change notification settings - Fork 2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Add distribution parameters as named positional arguments #5880
Comments
Yeah, this is indeed very annoying. By deleting the Maybe one can monkeypatch autogenerated |
We should be using functions instead of classes |
@michaelosthege I see you're the author of the I still think init methods for the parameters is a good idea, despite the redundancy, at least until someone has a better idea. As it currently stands, it does raise the barrier for new users. @ricardoV94 I see your bullet list in #5308 - how are you proposing using functions instead of classes? |
If you follow the call stack you'll notice that we never do anything with the classes other than accessing the static property |
I think @ricardoV94 is right that we should refactor distributions to be functions. This is, however, a major refactoring and needs to be done right. The logic from Also the more complicated distributions like GPs, timeseries, ODEs will have to be considered. Just to thinking out loud how we could get there:
One of the bigger questions I have is how to deal with
We should continue this discussion elsewehere (a Discussion?), by the way. It's beyond the scope of this issue. |
Agree with this being out of context, but regarding:
I also thought about |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Description of your problem
PyMC sideliner here, who is finally taking a proper crack at it with 4.0. I find the distribution docstrings difficult to parse when viewing them in my editor. As an example, the Bernoulli distribution in jupyter notebook (I imagine a lot of people are using notebooks):
And with VSCode (I am using this):
Two points:
pm.Bernoulli(name, *args, **kwargs)
/(name: Unknown, *args: Unknown, **kwargs: Unknown) -> TensorVariable
. It would be much nicer to actually show the parameters taken by the distribution (in this case,p
).__init__
method rather than the class docstring*. SinceBernoulli
doesn't have an explicit init method, it inherits from the first one it finds, which seems to be the__new__
method of theDistribution
class. Note that if you position the cursor (|
) asBernoulli|()
when invoking the documentation, you get the Bernoulli class docs and not the parent new doc. It would be nice to supply a simple docstring to the init method in order to override the confusing parentDIstribution
docstring.I am quite happy to take a crack at this, though I do recognise that there are several other issues concerned with similar things #5308, #5353, #5358)
Versions and main components
The text was updated successfully, but these errors were encountered: