Skip to content
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

Fix deprecation warning force_all_finite -> ensure_all_finite from 1.7 to 1.8 #206

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

icarosadero
Copy link
Contributor

@icarosadero icarosadero commented Dec 17, 2024

I keep getting this renaming warning from sklearn, so I just renamed the variables to the new ones:

/opt/conda/lib/python3.11/site-packages/sklearn/utils/deprecation.py:151](https://file+.vscode-resource.vscode-cdn.net/opt/conda/lib/python3.11/site-packages/sklearn/utils/deprecation.py:151): FutureWarning: 'force_all_finite' was renamed to 'ensure_all_finite' in 1.6 and will be removed in 1.8.
  warnings.warn(

See the deprecation warning in the docs

@cla-bot cla-bot bot added the CLA signed label Dec 17, 2024
@stes
Copy link
Member

stes commented Dec 17, 2024

Hi @icarosadero , thanks a lot for fixing! Do you happen to know when the ensure_all_finite was introduced in scikit-learn and have a reference to the docs? As the code will require this as the new minimal version then to function, I guess?

Copy link
Member

@stes stes left a comment

Choose a reason for hiding this comment

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

ok so it seems that this is indeed an issue also for recent versions of scikit-learn:
image

If you want to take a shot at solving this, have a look at e.g. this snippet of code

def check_version(estimator):
# NOTE(stes): required as a check for the old way of specifying tags
# https://github.com/scikit-learn/scikit-learn/pull/29677#issuecomment-2334229165
from packaging import version
return version.parse(sklearn.__version__) < version.parse("1.6.dev")

You could then implement a conditional part where the version is checked, and the arg is passed based on the version of sklearn.

Copy link
Member

@stes stes left a comment

Choose a reason for hiding this comment

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

I made a suggestion which is a bit more crisp and avoids code duplication

cebra/integrations/sklearn/utils.py Outdated Show resolved Hide resolved
cebra/integrations/sklearn/utils.py Outdated Show resolved Hide resolved
cebra/integrations/sklearn/utils.py Outdated Show resolved Hide resolved
@stes
Copy link
Member

stes commented Dec 18, 2024

could you also update the PR description with the reference to the docs, pointing that this API change happend from 1.7.x to 1.8.x?

@icarosadero icarosadero requested a review from stes December 18, 2024 11:02
@icarosadero icarosadero changed the title Fix deprecation warning force_all_finite -> ensure_all_finite Fix deprecation warning force_all_finite -> ensure_all_finite from 1.7 to 1.8 Dec 18, 2024
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.

2 participants