Closed Gabriel-p closed 2 years ago
Seems only reproduce at MacOS
------------------------------- Captured stdout --------------------------------
Command '['/usr/local/miniconda/envs/CB/bin/python', '/Users/runner/work/1/s/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py']' returned non-zero exit status 1.
------------------------------- Captured stderr --------------------------------
dispatcher.py:151: FutureWarning:
Scikit-learn patching with daal4py is deprecated and will be removed in the future.
Use Intel(R) Extension for Scikit-learn* module instead (pip install scikit-learn-intelex).
To enable patching, please use one of the following options:
1) From the command line:
python -m sklearnex <your_script>
2) From your script:
from sklearnex import patch_sklearn
patch_sklearn()
Intel(R) oneAPI Data Analytics Library solvers for sklearn enabled: https://intelpython.github.io/daal4py/sklearn.html
Traceback (most recent call last):
File "/Users/runner/work/1/s/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py", line 117, in <module>
run_algotithms()
File "/Users/runner/work/1/s/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py", line 93, in run_algotithms
run_patch(info, t)
File "/Users/runner/work/1/s/daal4py/sklearn/monkeypatch/tests/utils/_launch_algorithms.py", line 61, in run_patch
model.fit(X, y)
File "/usr/local/miniconda/envs/CB/lib/python3.9/site-packages/sklearn/decomposition/_pca.py", line 402, in fit
self.n_oversamples,
AttributeError: 'PCA' object has no attribute 'n_oversamples'
=========================== short test summary info ============================
ERROR s/daal4py/sklearn/monkeypatch/tests/test_patching.py - SystemExit: 1
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
Hi @Gabriel-p @FavorMylikes Thank your for your detailed reports. It seems due to new sklearn version 1.1.1, where we have some new parameters for PCA such as n_oversamples
. So it is sklearex bug.
Running into the same issue, how do we solve it?
Running into the same issue, how do we solve it?
@mjoy296 Downgrade sklearn
to 1.0.2
@mjoy296, I'm running into the same issue as well.
@FavorMylikes, I appreciate your solution but unfortunately I can't downgrade sklearn
to 1.0.2
as I have dependencies on 1.1
.
As seen in latest sklearn (1.1.2) docs there are new PCA()
parameters since 1.1
:
n_oversamples : int, default=10
power_iteration_normalizer : {‘auto’, ‘QR’, ‘LU’, ‘none’}, default=’auto’
Here are evidences:
>>> from sklearnex import patch_sklearn
>>> patch_sklearn()
Intel(R) Extension for Scikit-learn* enabled (https://github.com/intel/scikit-learn-intelex)
>>> from sklearn.decomposition import PCA
>>> p = PCA()
>>> p.get_params()
{'copy': True, 'iterated_power': 'auto', 'n_components': None, 'random_state': None, 'svd_solver': 'auto', 'tol': 0.0, 'whiten': False}
>>> from sklearnex import unpatch_sklearn
>>> unpatch_sklearn()
>>> from sklearn.decomposition import PCA
>>> p = PCA()
>>> p.get_params()
{'copy': True, 'iterated_power': 'auto', 'n_components': None, 'n_oversamples': 10, 'power_iteration_normalizer': 'auto', 'random_state': None, 'svd_solver': 'auto', 'tol': 0.0, 'whiten': False}
I wonder if sklearnex
could support new default PCA()
parameters "from the future" or at least ignore their existence, otherwise I'd prefer to sklearnex.unpatch_sklearn()
just for PCA()
as its performance seems acceptable without sklearnex
for now.
Eventually I would seek for more PCA performance by other means like using GPUs with the PCA from RAPIDS/cuml.
Describe the bug
Attempting to run the code below results in an error when
sklearnex
is combined withPCA
. This line produces the error shown belowthis line does not
To Reproduce
Store this code in a
PCA_test.py
file and call using the commands aboveExpected behavior No error
Output/Screenshots
Environment: