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

Incompatibility with scikit-learn 1.2+: Deprecation of if_delegate_has_method in eli5 library #426

Open
e5science opened this issue Nov 1, 2024 · 0 comments

Comments

@e5science
Copy link

I've encountered an import error when trying to use the eli5 library with the latest version of scikit-learn (1.2+). The error message is as follows:
ImportError: cannot import name 'if_delegate_has_method' from 'sklearn.utils.metaestimators' (path_to_sklearn\utils\metaestimators.py)

The if_delegate_has_method decorator has been deprecated and removed from scikit-learn in version 1.2, and it has been replaced by the available_if decorator. This issue arises when attempting to use eli5 for permutation importance with a trained model.

Steps to Reproduce:

Install the latest versions of scikit-learn and eli5.
Attempt to import eli5 and use PermutationImportance.
Observe the ImportError.

Proposed Solution:

Update the import statements in the eli5 library to use the new available_if decorator from scikit-learn's metaestimators module.

Environment:

Python version: 3.x
scikit-learn version: 1.2+
eli5 version: latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant