Add n_jobs=-1 for the BaggingClassifier

main
Aurélien Geron 2022-05-18 15:46:28 +12:00
parent f92a7497f8
commit 4024fbc40d
1 changed files with 4 additions and 4 deletions

View File

@ -342,7 +342,7 @@
"data": {
"text/plain": [
"BaggingClassifier(base_estimator=DecisionTreeClassifier(), max_samples=100,\n",
" n_estimators=500, random_state=42)"
" n_estimators=500, n_jobs=-1, random_state=42)"
]
},
"execution_count": 12,
@ -355,7 +355,7 @@
"from sklearn.tree import DecisionTreeClassifier\n",
"\n",
"bag_clf = BaggingClassifier(DecisionTreeClassifier(), n_estimators=500,\n",
" max_samples=100, random_state=42)\n",
" max_samples=100, n_jobs=-1, random_state=42)\n",
"bag_clf.fit(X_train, y_train)"
]
},
@ -438,7 +438,7 @@
],
"source": [
"bag_clf = BaggingClassifier(DecisionTreeClassifier(), n_estimators=500,\n",
" oob_score=True, random_state=42)\n",
" oob_score=True, n_jobs=-1, random_state=42)\n",
"bag_clf.fit(X_train, y_train)\n",
"bag_clf.oob_score_"
]
@ -2058,7 +2058,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.9.10"
},
"nav_menu": {
"height": "252px",