Skip to content

scikit-learn 1.7.0+ compatibility: address BaseEstimator._validate_data deprecation and removal #24

@jhtullis

Description

@jhtullis

Issue Type:

  • Bug report
  • Feature request
  • Documentation issue
  • Compatibility issue
  • Performance issue
  • Other (please specify)

Description:

When Stabl is used with sklearn version 1.6.0, there are deprecation warnings regarding the BaseEstimator._validate_data method when the Stabl or LowInfoFilter classes are fit since they inherit from BaseEstimator. With sklearn version 1.7.0, there a runtime error instead because the method is removed from the BaseEstimator class in this version.

Here is a screenshot of the warning in 1.6.0:

Image

Proposed solution:

I will submit a pull request implementing a backwards-compatible solution through scikit-learn version 1.7.0. It adds a _validate_data method to the Stabl and LowInfoFilter classes that

  • checks the environment's version of scikit-learn
  • with sklearn < 1.6.0: calls the BaseEstimator._validate_data method directly
  • with sklearn >= 1.6.0: calls the sklearn.utils.validate_data method as recommended in the warning

Context:

Stabl is demonstrated in the Nature Biotechnology paper (Hédou et al 2024) and tutorial notebook as a powerful feature selector. Thank you for creating and maintaining this awesome tool! I would love to see it stay up-to-date with scikit-learn so new features can be used alongside Stabl. Also, so that Stabl can be more seamlessly integrated into larger pipelines without version conflicts.

After testing my solution with scikit-learn 1.7.0, I saw there are other unrelated compatibility issues, but this change would help make Stabl more compatible with 1.7.0. The change is also backwards compatible, so it shouldn't interfere with current behavior (I tested it with version 1.3.2 and it worked as expected).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions