Set max_features="sqrt" in Decision Tree rather than BaggingClassifier

main
Aurélien Geron 2021-03-04 23:06:21 +13:00
parent 33f9ff10b4
commit e10a807907
1 changed files with 2 additions and 4 deletions

View File

@ -327,11 +327,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)"
]
},
{