[MRG] TST arch-dependent divide-by-zero warning#10480
Merged
jnothman merged 3 commits intoscikit-learn:masterfrom Feb 12, 2018
Merged
[MRG] TST arch-dependent divide-by-zero warning#10480jnothman merged 3 commits intoscikit-learn:masterfrom
jnothman merged 3 commits intoscikit-learn:masterfrom
Conversation
rth
reviewed
Feb 9, 2018
| clean_warning_registry() | ||
| with warnings.catch_warnings(record=True) as w: | ||
| 1. / np.array([0.]) | ||
| numpy_provides_div0_warning = len(w) == 1 |
Member
There was a problem hiding this comment.
Side comment: I imagine it could have been worth exposing the numpy_provides_div0_warning under some module in sklearn.utils if it was re-used elsewhere, but that doesn't seem to be the case now. Essentially it's a platform compatibility flag in line with other fixes in sklearn/utils/fixes.py.
Member
Author
rth
reviewed
Feb 12, 2018
sklearn/utils/testing.py
Outdated
| def assert_warns_div0(func, *args, **kw): | ||
| """Assume that numpy's warning for bad divide is raised | ||
|
|
||
| Handles the case that platforms do not support warning on divide by zero |
sklearn/utils/testing.py
Outdated
|
|
||
|
|
||
| def assert_warns_div0(func, *args, **kw): | ||
| """Assume that numpy's warning for bad divide is raised |
TomDLT
approved these changes
Feb 12, 2018
Member
Author
|
thanks for the reviews |
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.
Fixes #7572. @yarikoptic, I hope this solves the ARMEL issue.