scikit-learn-intelex
scikit-learn-intelex copied to clipboard
Patching scikit-learn dev version fails with: ImportError: cannot import name '_logistic_loss_and_grad' from 'sklearn.linear_model._logistic'
The development version of scikit-learn now uses a unified loss module for several estimators including Logistic Regression: https://github.com/scikit-learn/scikit-learn/pull/21808
This causes the following problem when using the latest version of scikit-learn-intelex (from conda-forge) on the development version of scikit-learn.
[...]
File "/usr/share/miniconda/envs/sklbench/lib/python3.8/site-packages/daal4py/sklearn/__init__.py", line 17, in <module>
from .monkeypatch.dispatcher import enable as patch_sklearn
File "/usr/share/miniconda/envs/sklbench/lib/python3.8/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py", line 30, in <module>
from ..linear_model.coordinate_descent import Lasso as Lasso_daal4py
File "/usr/share/miniconda/envs/sklbench/lib/python3.8/site-packages/daal4py/sklearn/linear_model/__init__.py", line 19, in <module>
from .logistic_path import logistic_regression_path, LogisticRegression
File "/usr/share/miniconda/envs/sklbench/lib/python3.8/site-packages/daal4py/sklearn/linear_model/logistic_path.py", line 37, in <module>
from sklearn.linear_model._logistic import (
ImportError: cannot import name '_logistic_loss_and_grad' from 'sklearn.linear_model._logistic' (/usr/share/miniconda/envs/sklbench/lib/python3.8/site-packages/sklearn/linear_model/_logistic.py)
I tried to explore the CI to see if there was a nightly build that could have already detected this problem that will impact the next release but could not find it. Sorry if this problem was already known or fixed in the dev version of scikit-learn-intelex.
Side comment: are there any nightly builds of scikit-learn-intelex published anywhere (e.g. as a wheel or a conda package)?
Hi @ogrisel, Thanks for submitting issue. We have reproduced this issue and included a fix in the 2021.6 release, which will be released at the end of March. However, the Intel(R) extension for scikit-learn may still become unstable with the scikit-learn master.
Unfortunately we don't currently have a public space with nightly builds. Feel free to ask any questions.
@ogrisel - would it be sufficient if nightly can just would store artifact - this would be not super friendly approach although. Also a note - there would be difference between what we have in public CI and bits that we are deploying eventually as they come from internal CI.
A CI artifact would already be useful even if not that easy to install with pip or conda.
For scikit-learn we upload nightly built wheels in the pypi-compatible service of anaconda.org:
https://scikit-learn.org/stable/developers/advanced_installation.html#installing-nightly-builds
https://github.com/scikit-learn/scikit-learn/blob/4a52eb6de9b4533518a677123c9b11927fe8604f/.github/workflows/wheels.yml#L225-L231
If you prefer uploading packages on conda-forge, it should be possible to use a dedicated dev
label for instance.
Fixed in https://github.com/intel/scikit-learn-intelex/pull/980 and 2021.6 release