8000 ElasticNetCV fails under loky backend · Issue #14249 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

ElasticNetCV fails under loky backend #14249

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

Closed
pierreglaser opened this issue Jul 3, 2019 · 1 comment · Fixed by #14264
Closed

ElasticNetCV fails under loky backend #14249

pierreglaser opened this issue Jul 3, 2019 · 1 comment · Fixed by #14264
Labels

Comments

@pierreglaser
Copy link
Contributor

running this script:

from sklearn.linear_model import ElasticNetCV
from sklearn.datasets import make_regression
from joblib import parallel_backend
X, y = make_regression(20000, 10)
clf = ElasticNetCV(n_jobs=2, cv=20)
with parallel_backend(backend='loky'):
    clf.fit(X, y)

fails with:

"""
Traceback (most recent call last):
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 418, in _process_worker
    r = call_item()
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 272, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 567, in __call__
    return self.func(*args, **kwargs)
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/parallel.py", line 225, in __call__
    for func, args, kwargs in self.items]
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/parallel.py", line 225, in <listcomp>
    for func, args, kwargs in self.items]
  File "/home/pierreglaser/repos/scikit-learn/sklearn/linear_model/coordinate_descent.py", line 997, in _path_residuals
    copy=False)
  File "/home/pierreglaser/repos/scikit-learn/sklearn/linear_model/base.py", line 527, in _pre_fit
    check_input=check_input)
  File "/home/pierreglaser/repos/scikit-learn/sklearn/linear_model/base.py", line 158, in _preprocess_data
    X -= X_offset
ValueError: output array is read-only
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "bug.py", line 7, in <module>
    clf.fit(X, y)
  File "/home/pierreglaser/repos/scikit-learn/sklearn/linear_model/coordinate_descent.py", line 1195, in fit
    **_joblib_parallel_args(prefer="threads"))(jobs)
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/parallel.py", line 934, in __call__
    self.retrieve()
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/parallel.py", line 833, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/home/pierreglaser/.virtualenvs/sklearn_py36/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 521, in wrap_future_result
    return future.result(timeout=timeout)
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
ValueError: output array is read-only

The problem does not happen if the data is smaller -- My guess is that _pre_fit tries to modify in-place the input (in this case, _pre_fit is called with copy=False), which using loky and large data, is memmaped, thus read-only. Hence the error.

@rth rth added the Bug label Jul 3, 2019
@pierreglaser
Copy link
Contributor Author

This bug also affects LassoCV.

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

Successfully merging a pull request may close this issue.

2 participants
0