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

Skip to content

MAINT fix deprecation raised in scipy-dev build #25175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Dec 15, 2022

Conversation

glemaitre
Copy link
Member

@glemaitre glemaitre commented Dec 12, 2022

@glemaitre glemaitre marked this pull request as draft December 12, 2022 11:25
@@ -22,11 +22,12 @@

Copy link
Member Author

Choose a reason for hiding this comment

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

I will revert those changes where black decided that I should not only change a single line ;)

from scipy.sparse.linalg import aslinearoperator
from numpy import block as bmat

from ..utils.fixes import _eigh
Copy link
Member

Choose a reason for hiding this comment

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

Apparently this is introducing a circular dependency in the doc builds...

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, for the oldest version of SciPy, we are doing circular imports. Let me try to solve this one (I will revert black as well).

@@ -19,7 +19,7 @@
.. [3] A. V. Knyazev's C and MATLAB implementations:
https://github.com/lobpcg/blopex
"""

import inspect
Copy link
Member Author

Choose a reason for hiding this comment

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

I would like to apply the following sync before making this change here:

#25176

@glemaitre
Copy link
Member Author

The latest failure feels like a change in lobpcg in SciPy main that change the behavior.
I have to check if our test is too brittle or if this is a tolerable change of behavior.

@glemaitre
Copy link
Member Author

#25176 confirm that the issue is linked to the version of SciPy.

@glemaitre glemaitre marked this pull request as ready for review December 13, 2022 10:33
@@ -20,6 +20,7 @@
from ..utils import check_random_state, check_array
from ..utils._arpack import _init_arpack_v0
from ..utils._param_validation import Interval, StrOptions
from ..utils.fixes import eigh
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a private method? Historically, we have removed public functions from utils.fixes without deprecation, which I always found inconsistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

The advantage of having eigh public is that the body of the code does not change in the future. What would make sense is to have fixes private itself (i.e. _fixes).

I don't know what is best here.

Copy link
Member

Choose a reason for hiding this comment

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

The advantage of having eigh public is that the body of the code does not change in the future.

I don't understand this. Why would renaming it _eigh be a problem?

+1 for deprecating sklearn.utils.fixes in favor of sklearn.utils._fixes in a follow-up PR anyway.

Copy link
Member

@lesteve lesteve Dec 15, 2022

Choose a reason for hiding this comment

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

I agree with @ogrisel:

  • let's use _eigh for this PR
  • let's make utils.fixes private, I tried to find some past discussions about why it was not made private but I did not find anything in ~15 minutes. Maybe one reason I can think of is that we sometimes use utils.fixes in examples and that it would be a bit weird to use private stuff in examples. Personally I can live with using utils._fixes in examples when the alternative makes the example code a lot more complicated. Right now we have 4 examples using utils.fixes.

Copy link
Member

Choose a reason for hiding this comment

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

I just pushed a commit doing that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, @lesteve for the push. Since we are few utils.fixes, it could be the right time to make it private and deprecate it (of course in another PR).

@lesteve
Copy link
Member

lesteve commented Dec 15, 2022

The codecov patch error is because some of the lines in the diff are not covered by tests, you can see them in the "Files tab"

I check manually that indeed these lines are not covered by any tests.

I don't think it should block this PR anyway.

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasjpfan thomasjpfan merged commit b0bf231 into scikit-learn:main Dec 15, 2022
@thomasjpfan thomasjpfan added this to the 1.2.1 milestone Dec 15, 2022
@thomasjpfan
Copy link
Member

I'm marking this for 1.2.1 so the deprecation warnings do not appear in 1.2.X when SciPy 1.5 is released.

jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 3, 2023
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 20, 2023
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 20, 2023
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 23, 2023
adrinjalali pushed a commit that referenced this pull request Jan 24, 2023
Co-authored-by: Olivier Grisel <[email protected]>
Co-authored-by: Loïc Estève <[email protected]>
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.

4 participants