From 05622d26b82ab7ae2e33ea529a45e1c5d7e9d6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Geron?= Date: Mon, 6 Jul 2020 20:46:48 +1200 Subject: [PATCH] Fix early stopping example, fixes #190 --- 04_training_linear_models.ipynb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/04_training_linear_models.ipynb b/04_training_linear_models.ipynb index b0dea2b..0ac4d1a 100644 --- a/04_training_linear_models.ipynb +++ b/04_training_linear_models.ipynb @@ -845,7 +845,7 @@ }, "outputs": [], "source": [ - "from sklearn.base import clone\n", + "from copy import deepcopy\n", "\n", "poly_scaler = Pipeline([\n", " (\"poly_features\", PolynomialFeatures(degree=90, include_bias=False)),\n", @@ -868,8 +868,7 @@ " if val_error < minimum_val_error:\n", " minimum_val_error = val_error\n", " best_epoch = epoch\n", - " best_model = sgd_reg\n", - " sgd_reg = clone(sgd_reg)" + " best_model = deepcopy(sgd_reg)" ] }, {