From e10a807907791b287e1de44120797a2e8da9a165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Geron?= Date: Thu, 4 Mar 2021 23:06:21 +1300 Subject: [PATCH] Set max_features="sqrt" in Decision Tree rather than BaggingClassifier --- 07_ensemble_learning_and_random_forests.ipynb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/07_ensemble_learning_and_random_forests.ipynb b/07_ensemble_learning_and_random_forests.ipynb index 0aabfed..8854af5 100644 --- a/07_ensemble_learning_and_random_forests.ipynb +++ b/07_ensemble_learning_and_random_forests.ipynb @@ -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)" ] }, {