Add distribution parameters as named positional arguments #6083
Replies: 7 comments
-
Yeah, this is indeed very annoying. By deleting the Maybe one can monkeypatch autogenerated |
Beta Was this translation helpful? Give feedback.
-
We should be using functions instead of classes |
Beta Was this translation helpful? Give feedback.
-
@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? |
Beta Was this translation helpful? Give feedback.
-
If you follow the call stack you'll notice that we never do anything with the classes other than accessing the static property |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Agree with this being out of context, but regarding:
I also thought about |
Beta Was this translation helpful? Give feedback.
-
Sidenote: I independently ran into this same issue, and agree that a whole refactoring is a major challenge. Perhaps if there is a way to alleviate this issue without refactoring in the meanwhile we can consider that here |
Beta Was this translation helpful? Give feedback.
-
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 recognize that there are several other issues concerned with similar things #5308, #5353, #5358)
Versions and main components
Beta Was this translation helpful? Give feedback.
All reactions