"RuntimeWarning: invalid value encountered in true_divide" in tests
See original GitHub issueThe following tests throw a RuntimeWarning
RuntimeWarning: invalid value encountered in true_divide
in the current development version
-
test_sanity_check_pls_regression_constant_column_Y
insklearn/cross_decomposition/tests/test_pls.py
-
test_iforest_with_uniform_data
insklearn/ensemble/tests/test_iforest.py
-
test_kernel_gradient
insklearn/gaussian_process/tests/test_kernels.py
-
test_radius_neighbors_classifier_zero_distance
insklearn/neighbors/tests/test_neighbors.py
-
test_calibration_multiclass[0-True-isotonic]
insklearn/tests/test_calibration.py
-
test_estimators[LinearDiscriminantAnalysis()-check_classifiers_one_label]
insklearn/tests/test_common.py
-
test_random_choice_csc
insklearn/utils/tests/test_random.py
Those warnings are caused by matricial divisions having some element equal to zero in the denominator, either in the test itself or in the function/class called by the test.
The failure can be reproduced locally using
pytest -Werror::RuntimeWarning <test_file.py> -k <test_name>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11 (11 by maintainers)
Top Results From Across the Web
How to Fix: invalid value encountered in true_divide - Statology
This warning occurs when you attempt to divide by some invalid value (such as NaN, Inf, etc.) in a NumPy array. It's worth...
Read more >RuntimeWarning: invalid value encountered in divide
You have nan s for rr , which is throwing that error. The issue with rr is stemming from r[i,:] which is equal,...
Read more >NumPy Fix: Invalid Value Encountered in true_divide
In this quick breakdown, we'll look at such a case where NumPy might produce a runtime warning indicating that an invalid value was...
Read more >invalid value encountered in true_divide return n/db/n.sum ...
[Solved]-Python RuntimeWarning: invalid value encountered in true_divide return n/db/n.sum(), bin_edges-numpy.
Read more >Debian Bug report logs - #997081 statsmodels: FTBFS: tests fail
self = <statsmodels.imputation.tests.test_mice. ... RuntimeWarning: invalid value encountered in true_divide > B_x = (G_numer * d_fx ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The list is complete. Thank you all for your contributions.
@lorentzenchr I am still trying to figure out the right way to solve this issue, but I can surely open a PR right now!