-
Notifications
You must be signed in to change notification settings - Fork 0
feat(core, distributions): switch to generics #96
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
Conversation
rework_tests/unit/distributions/test_continuous_distribution.py
Outdated
Show resolved
Hide resolved
rework_tests/unit/distributions/test_continuous_distribution.py
Outdated
Show resolved
Hide resolved
rework_tests/unit/distributions/test_continuous_distribution.py
Outdated
Show resolved
Hide resolved
rework_tests/unit/distributions/test_continuous_distribution.py
Outdated
Show resolved
Hide resolved
iraedeus
left a comment
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.
There are many uses of np.isclose or np.assert_allclose with arbitrary atol values for all dtypes. I suggest trying atol=np.finfo(dtype).eps
| X = np.asarray(X, dtype=float64) | ||
| X = np.asarray(X, dtype=self.dtype) | ||
| component_pdfs = np.array([comp.pdf(X) for comp in self.components]) | ||
| return np.asarray(np.dot(self.weights, component_pdfs)) |
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.
| """ | ||
|
|
||
| X = np.atleast_1d(X) | ||
| X = np.atleast_1d(X).astype(self.dtype) |
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.
| X = np.atleast_1d(X).astype(self.dtype) | |
| X = np.asarray(X, dtype=self.dtype) |
488aa59 to
fa9cbae
Compare
fa9cbae to
cd36859
Compare
VITYANA
left a comment
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.
I think that's good, but somewhere maybe it won't work with float16 (np.isclose etc)

This pull request refactors the core and distributions modules to use generic numeric types.
Implementation:
typing.Genericwith aTypeVar("DType").