-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add type hints to dist() for discrete distributions #6937
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?
Add type hints to dist() for discrete distributions #6937
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6937 +/- ##
=======================================
Coverage 92.83% 92.83%
=======================================
Files 106 106
Lines 17669 17675 +6
=======================================
+ Hits 16403 16409 +6
Misses 1266 1266
|
I originally made some comments on this PR, which I then turned into a feature request that I am willing to work on, over at #7122. |
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.
Flyby review here, not a maintainer (though keen on pymc and type checking).
With the exception of one bit, this looks good to me.
d2ba0fa
to
50123a1
Compare
The mypy error is going to be a pain to fix. Here is a minimum repro of the issue. class Dist:
def dist(self, *args: int):
return 1
class Foo(Dist):
def dist(self, foo: int, bar: int):
return 1
The issue is that in the Distribution class we have: @classmethod
def dist(
cls,
dist_params, # <-- main issue is here
*,
shape: Shape | None = None,
**kwargs,
) -> TensorVariable: For the Binomial class we have multiple parameters where the superclass (Distribution) has one, and that one isn't even an
I am tempted to suggest that this PR won't be merged and that we focus on replacing the class-based system with a function-based one as per #5308. |
What is this PR about?
Add type hints to the dist() class methods in the discrete distributions.
Issue #5358
Discussion points:
cutpoints
parameter in OrderedProbit and OrderedLogisticChecklist
Major / Breaking Changes
N/A
New features
N/A
Bugfixes
N/A
Documentation
N/A
Maintenance
N/A
📚 Documentation preview 📚: https://pymc--6937.org.readthedocs.build/en/6937/