Skip to content

Commit

Permalink
Set max_features="sqrt" in Decision Tree rather than BaggingClassifier
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron committed Mar 4, 2021
1 parent 7aa0ead commit 28db1cd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions 07_ensemble_learning_and_random_forests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,9 @@
"metadata": {},
"outputs": [],
"source": [
"from math import ceil, sqrt\n",
"\n",
"bag_clf = BaggingClassifier(\n",
" DecisionTreeClassifier(max_leaf_nodes=16),\n",
" n_estimators=500, max_features=ceil(sqrt(X_train.shape[1])), random_state=42)"
" DecisionTreeClassifier(max_features=\"sqrt\", max_leaf_nodes=16),\n",
" n_estimators=500, random_state=42)"
]
},
{
Expand Down Expand Up @@ -471,7 +469,7 @@
{
"data": {
"text/plain": [
"0.952"
"1.0"
]
},
"execution_count": 18,
Expand Down

0 comments on commit 28db1cd

Please sign in to comment.