TST Sets random state in test_csr_row_norms#16509
Merged
rth merged 4 commits intoscikit-learn:masterfrom Feb 21, 2020
Merged
Conversation
|
how does setting random state make the test more deterministic? |
rth
approved these changes
Feb 21, 2020
jeremiedbb
requested changes
Feb 21, 2020
Member
jeremiedbb
left a comment
There was a problem hiding this comment.
Setting the random_state to make the test pass is not enough. We need to fix the thing that makes the test fail. Here it's because a rtol of 1e-7 is not suitable for float32 because machine precision is ~1.2e-7.
I suggest to use rtol=1e-6 for float32
jeremiedbb
reviewed
Feb 21, 2020
|
|
||
| assert norms.dtype == dtype | ||
| assert_allclose(norms, scipy_norms) | ||
| rtol = 1e-6 if dtype == np.float32 else 1e-7 |
Member
There was a problem hiding this comment.
don't remove the other assert 😄
jeremiedbb
approved these changes
Feb 21, 2020
Member
jeremiedbb
left a comment
There was a problem hiding this comment.
lgtm. Thanks @thomasjpfan ! feel free to merge when green
thomasjpfan
added a commit
to thomasjpfan/scikit-learn
that referenced
this pull request
Feb 22, 2020
panpiort8
pushed a commit
to panpiort8/scikit-learn
that referenced
this pull request
Mar 3, 2020
gio8tisu
pushed a commit
to gio8tisu/scikit-learn
that referenced
this pull request
May 15, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Fixes #16506
What does this implement/fix? Explain your changes.
Makes test deterministic by setting random state in
test_csr_row_norms.The alternative is to lower the tolerance for
float32.