Skip to content

Commit

Permalink
SGD now defaults to lr=0.01 so use 1e-3 explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron committed Jun 10, 2019
1 parent 595a80d commit a52ae7e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions 13_loading_and_preprocessing_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@
"metadata": {},
"outputs": [],
"source": [
"model.compile(loss=\"mse\", optimizer=\"sgd\")"
"model.compile(loss=\"mse\", optimizer=keras.optimizers.SGD(lr=1e-3))"
]
},
{
Expand Down Expand Up @@ -2606,7 +2606,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)"
]
},
Expand Down Expand Up @@ -2825,7 +2827,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)"
]
},
Expand Down

0 comments on commit a52ae7e

Please sign in to comment.