Repository navigation
Closed
Milestone
Description
Description
I just update to the 0.18 version, and I've now a recurrent parallelizing warning message that was absent previously.
Steps/Code to Reproduce
The code bellow is adapted from an online example, using several features selections. The same didn't produce a warning message with the previous scikit version.
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.model_selection import GridSearchCV
from sklearn.svm import SVC
from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
from sklearn.feature_selection import SelectKBest
if __name__ == '__main__':
iris = load_iris()
X, y = iris.data, iris.target
# This dataset is way too high-dimensional. Better do PCA:
pca = PCA(n_components=2)
# Maybe some original features where good, too?
selection = SelectKBest(k=1)
# Build estimator from PCA and Univariate selection:
combined_features = FeatureUnion([("pca", pca), ("univ_select", selection)], n_jobs=1)
# Use combined features to transform dataset:
X_features = combined_features.fit(X, y).transform(X)
svm = SVC(kernel="linear")
# Do grid search over k, n_components and C:
pipeline = Pipeline([("features", combined_features), ("svm", svm)])
param_grid = dict(features__pca__n_components=[1, 2, 3],
features__univ_select__k=[1, 2],
svm__C=[0.1, 1, 10])
grid_search = GridSearchCV(pipeline, param_grid=param_grid, verbose=0, n_jobs=-1)
grid_search.fit(X, y)
print(grid_search.best_estimator_)Actual Results
Here is the waning message :
joblib/parallel.py:540: UserWarning: Multiprocessing-backed parallel loops cannot be nested, setting n_jobs=1
**self._backend_args)
It looks like there is deep process using parallelization.
Versions
Linux-3.19.0-32-generic-x86_64-with-debian-jessie-sid
Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec 7 2015, 11:16:01)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
NumPy 1.11.1
SciPy 0.18.1
Scikit-Learn 0.18
Joblib 0.9.4
Reacted by Shihab Shahriar Khan
Metadata
Metadata
Assignees
Labels
No labels
Activity
EtienneCmb commentedon Oct 2, 2016
An other example producing the same warning message :
lesteve commentedon Oct 3, 2016
It is very likely related to joblib/joblib#406. We will 1) fix this warning in joblib first, 2) release a new joblib version 3) update the joblib copy bundled with scikit-learn.
@EtienneCmb just a tip you can have syntax highlighting in your snippet by adding
pyafter the initial three backquotes. Read fenced code blocks for more details.EtienneCmb commentedon Oct 3, 2016
Ok, I didn't saw that it was already solved! For instance I run my script without warning message (python -W ignore myscript.py). Thanks for the syntax highlighting, I just updated my post with your advice.
lesteve commentedon Oct 3, 2016
It has already been reported but not already solved.
Another tip, you can use the
PYTHONWARNINGSenvironment variable to selectively ignore warnings e.g. this seems to do the job:amueller commentedon Oct 14, 2016
@lesteve you tagged this 0.18.1. When are you planning to release and backport? I would like to do 0.18.1 within the next two weeks.
lesteve commentedon Oct 17, 2016
I was planning to do a joblib bugfix release indeed. I can do it this week and do a PR in scikit-learn.
amueller commentedon Oct 17, 2016
that would be sweet. Releasing sklearn next week would be ideal but might be somewhat optimistic.
lesteve commentedon Oct 18, 2016
@amueller I released a new joblib version and created a PR: #7696.