From 400920f0aa65dd7c32c9f6e9942dfa7b72e50d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Geron?= Date: Mon, 10 Jun 2019 10:53:32 +0800 Subject: [PATCH] SGD now defaults to lr=0.01 so use 1e-3 explicitly --- 13_loading_and_preprocessing_data.ipynb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/13_loading_and_preprocessing_data.ipynb b/13_loading_and_preprocessing_data.ipynb index f6f6993..89fa662 100644 --- a/13_loading_and_preprocessing_data.ipynb +++ b/13_loading_and_preprocessing_data.ipynb @@ -530,7 +530,7 @@ "metadata": {}, "outputs": [], "source": [ - "model.compile(loss=\"mse\", optimizer=\"sgd\")" + "model.compile(loss=\"mse\", optimizer=keras.optimizers.SGD(lr=1e-3))" ] }, { @@ -1511,7 +1511,9 @@ " keras.layers.DenseFeatures(feature_columns=columns_without_target),\n", " keras.layers.Dense(1)\n", "])\n", - "model.compile(loss=\"mse\", optimizer=\"sgd\", metrics=[\"accuracy\"])\n", + "model.compile(loss=\"mse\",\n", + " optimizer=keras.optimizers.SGD(lr=1e-3),\n", + " metrics=[\"accuracy\"])\n", "model.fit(dataset, steps_per_epoch=len(X_train) // batch_size, epochs=5)" ] }, @@ -1635,7 +1637,9 @@ " keras.layers.Flatten(input_shape=[28, 28, 1]),\n", " keras.layers.Lambda(lambda images: tf.cast(images, tf.float32)),\n", " keras.layers.Dense(10, activation=\"softmax\")])\n", - "model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"sgd\", metrics=[\"accuracy\"])\n", + "model.compile(loss=\"sparse_categorical_crossentropy\",\n", + " optimizer=keras.optimizers.SGD(lr=1e-3),\n", + " metrics=[\"accuracy\"])\n", "model.fit(mnist_train, steps_per_epoch=60000 // 32, epochs=5)" ] },