-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Extend unittests for some distributions. #42
Conversation
Codecov Report
@@ Coverage Diff @@
## main #42 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 295 288 -7
Branches 20 20
=========================================
- Hits 295 288 -7
Continue to review full report at Codecov.
|
For what its worth: the def multivariate_normal_bhattacharya2016(rng, D, phi, alpha):
return multivariate_normal_cong2017(rng, 1 / D, at.ones(phi.shape[0]), phi, alpha) So not sure if this is worth a refactor and that the overhead of creating the |
BTW @rlouf while working on this PR today I realized that the tests in #32 previously failed for two reasons:
Which leads me to think that the |
Thank you! I have not seen For the documentation it was not always easy to find the corresponding parametrization in the references. A short explanation of the meaning of each parameter and how they relate to mean/covariance would be very useful. Besides these two point this looks good to me. |
Do you feel these two points should be a separate PR or part of this one? |
They can be part of this one; it will take you more time to open a separate PR than make these changes. |
@rlouf i've addressed your last 2 points in the latest commit. Please take a look at this again when you can,. |
The changes look good to me, however you will need to make some changes to your commits' structure:
|
This commit fixes/completes/extends previously minimal unittests for some of the available probability distribution samplers, which include: - `multivariate_normal_cong2017` - `multivariate_normal_bhattacharya2016`.
The algorithm in Bhattacharya (2016) can be seen as a special case of the `multivariate_normal_cong2017` function where `omega` is the identity matrix. This commit removes the redundant implementation of the Bhattacharya (2016) algorithm and then adds a unittest for this special case.
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.
Looks good to me.
phi: TensorVariable, | ||
t: TensorVariable, | ||
) -> TensorVariable: | ||
r""" |
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.
Nitpick: docstring should start after the """
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 this is mainly a preference thing. The current way is still correct according the numpydoc
convention and is used all over numpy and scipy source code. The pydocstyle
linter doesn't complain either on my editor.
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.
When you start a repo every reasonable choice is certainly a question of preference, in an existing codebase it is a matter of consistency. This format is used in other aesara
-related projects and I don't see a reason to do something different here.
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 understand your concern but dists.py
is the first module commited into the codebase and if you look at the other functions in it, they use the same docstring convention. That is about as consistent as can be in this case. Using the suggested preference would introduce an inconsistent docstring style in the module. So the point made here is a bit contradictory.
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 only two consistent choices here: change the docstrings in every other files in the repository, or press DEL twice in this file. Whatever you think is best.
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.
All the aesara-devs
projects follow the code and documentation standards of Aesara. In the case of docstrings, we use NumPy's format—more or less. (The link in our documentation is broken; it should be this.)
We have some legacy docstrings in the Aesara repo that go against this standard, but those need to be fixed.
FYI: the |
This commit fixes/completes/extends previously minimal unittests for
some of the available probability distribution samplers, which include:
multivariate_normal_cong2017
multivariate_normal_bhattacharya2016
.This is a followup of #32 and closes #33