-
Notifications
You must be signed in to change notification settings - Fork 331
Incompatibility with scikit-learn 1.2+: Deprecation of if_delegate_has_method in eli5 library #426
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
Comments
I have a fix for this by manually defining the depreciated function within permutation_importance.py and redirecting some of the eli5 imports to the official sklearn repos. In "PYTHON_INSTALL_PATH/site-packages/eli5/sklearn/permutation_importance.py" (replace PYTHON_INSTALL_PATH" with where you have python installed; for me it is "~./local/lib/python3.12"). The ammended code is:
|
hi, this is fixed in master branch of https://github.com/eli5-org/eli5 and we'll do a PyPI release soon |
this is fixed in the latest release on PyPI: 0.14.0 |
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
The text was updated successfully, but these errors were encountered: