Skip to content

CI warning: sklearn: 'force_all_finite' was renamed to 'ensure_all_finite' #3969

@connortann

Description

@connortann

Extract from pytest output:

../../../../../opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/sklearn/utils/deprecation.py:151: 8 warnings
tests/explainers/test_tree.py: 3 warnings
  /opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/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(

According to SPEC 0 , we need to support sklearn versions back to at least 1.3.0, so for now we need to handle both the new and the old arguments.

So, we need to ensure our code handles both cases, e.g.

from packaging import version
arg = "force_all_finite" if version.parse(sklearn.__version__) < version.parse("1.6") else "ensure_all_finite"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions