FIX Add support for scikit-learn 1.8#360
FIX Add support for scikit-learn 1.8#360dherrera1911 wants to merge 2 commits intoscikit-learn-contrib:masterfrom
scikit-learn 1.8#360Conversation
|
I ran the tests in For reference, this branch passes all tests with Interestingly, when using I looked into one of these tests, and as I supposed, it was a FutureWarning from scikit-learn, warning about sklearn/utils/deprecation.py:132: FutureWarning: 'force_all_finite' was renamed to 'ensure_all_finite' in 1.6 and will be removed in 1.8. |
_util.py::check_input()scikit-learn 1.8 breaking change
scikit-learn 1.8 breaking changescikit-learn 1.8
|
Thanks! I had to manually enable the CI to run on this PR, but it started now. |
| else: | ||
| def vector_norm(X): | ||
| return np.linalg.norm(X, axis=1) | ||
| import numpy as np |
There was a problem hiding this comment.
I'm confused why this line is showing up as part of the diff. Maybe a line-ending related change?
PR description at a high level:
Support
scikit-learn1.8, that introduced a breaking change. Maintain compatibility with versions <=1.7.Fixes #359
Describe changes:
In
scikit-learn1.8, the parameterforce_all_finitein the functionscheck_array()andcheck_X_y()was deprecated, and replaced forensure_all_finite.The function
_utils.py::check_input()uses the parameterforce_all_finite, making the package fail as described in #359.In this PR, we introduce the local wrapper functions
_check_array()and_check_X_y()inside of_utils.py. These wrappers work like theirscikit-learncounterparts, but are able to take bothforce_all_finiteandensure_all_finiteas inputs. Now_utils.pycalls the wrappers instead of directly calling the functions.Outstanding questions:
For transparency I mention that the original version of this PR was generated by a coding agent. After reviewing it, I concluded that the approach is sound. I did modify it considerably to make it simpler.
I have not tested this solution thoroughly, but I can run the relevant parts of the testing suite.