Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CI Fix scipy-dev remaining failures due to scipy sparse DeprecationWarning - #34632

Merged
ogrisel merged 2 commits into
scikit-learn:mainfrom
lesteve:fix-scipy-dev-sparse-deprecationwarning
Aug 4, 2026
Merged

CI Fix scipy-dev remaining failures due to scipy sparse DeprecationWarning#34632
ogrisel merged 2 commits into
scikit-learn:mainfrom
lesteve:fix-scipy-dev-sparse-deprecationwarning

Conversation

@lesteve

@lesteve lesteve commented Aug 2, 2026

Copy link
Copy Markdown
Member

Fix #34621.

Here are the issues that remained after #34614:

  • recwarn doesn't seem to take into account our warnings filters set through SKLEARN_WARNINGS_AS_ERRORS, which AFAICT this is not really documented and slightly surprising (pytest.warns on the other hand does use our warnings filters). I used warnings.catch_warnings + warnings.simplefilter on top with some explicit warning class to test that no warnings of a particular class was emitted.
  • some lingering uses of scipy.sparse.random, scipy.sparse.eye were replaced by the sklearn.utils.fixes equivalent.

assert_array_equal(enc.transform(X).toarray(), exp)


def test_one_hot_encoder_warning():

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hesitated to remove this test alltogether. My understanding is that the test was added in #10523 which split CategoricalEncoder into OneHotEncoder and OrdinalEncoder and added plenty of deprecations in doing so. This test was probably making sure that no deprecation warnings were being raised.

@lesteve

lesteve commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

The scipy-dev build is green.

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Let's merge to fix the CI.

Comment thread sklearn/utils/_testing.py
message=r"(?s).*All sparse matrix classes",
message=r"(?s).*All sparse matrix classes.+deprecated",
category=DeprecationWarning,
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that instead we could update our tests to avoid testing with scipy sparse matrices on the most recent scipy versions to avoid raising the deprecation warning instead of hiding it.

But we can proceed incrementally and consider this for a follow-up PR to ease the review process.

@ogrisel
ogrisel merged commit 82cc705 into scikit-learn:main Aug 4, 2026
49 of 50 checks passed
@github-project-automation github-project-automation Bot moved this from PR waiting for reviews to Done in Labs Aug 4, 2026
@lesteve
lesteve deleted the fix-scipy-dev-sparse-deprecationwarning branch August 4, 2026 20:04
prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 8, 2026
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚠️ CI failed on Unit tests Linux x86-64 pylatest_pip_scipy_dev (last failure: Aug 04, 2026) ⚠️

2 participants