SGD now defaults to lr=0.01 so use 1e-3 explicitely
parent
1973371b19
commit
3db31444cd
|
@ -511,7 +511,8 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"sgd\",\n",
|
"model.compile(loss=\"sparse_categorical_crossentropy\",\n",
|
||||||
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
" metrics=[\"accuracy\"])"
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -582,7 +583,8 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"sgd\",\n",
|
"model.compile(loss=\"sparse_categorical_crossentropy\",\n",
|
||||||
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
" metrics=[\"accuracy\"])"
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -661,7 +663,8 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"sgd\",\n",
|
"model.compile(loss=\"sparse_categorical_crossentropy\",\n",
|
||||||
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
" metrics=[\"accuracy\"])"
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -707,7 +710,8 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"sgd\",\n",
|
"model.compile(loss=\"sparse_categorical_crossentropy\",\n",
|
||||||
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
" metrics=[\"accuracy\"])"
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -866,8 +870,9 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"model_A.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"sgd\",\n",
|
"model_A.compile(loss=\"sparse_categorical_crossentropy\",\n",
|
||||||
" metrics=[\"accuracy\"])"
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -908,8 +913,9 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"model_B.compile(loss=\"binary_crossentropy\", optimizer=\"sgd\",\n",
|
"model_B.compile(loss=\"binary_crossentropy\",\n",
|
||||||
" metrics=[\"accuracy\"])"
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -961,7 +967,8 @@
|
||||||
"for layer in model_B_on_A.layers[:-1]:\n",
|
"for layer in model_B_on_A.layers[:-1]:\n",
|
||||||
" layer.trainable = False\n",
|
" layer.trainable = False\n",
|
||||||
"\n",
|
"\n",
|
||||||
"model_B_on_A.compile(loss=\"binary_crossentropy\", optimizer=\"sgd\",\n",
|
"model_B_on_A.compile(loss=\"binary_crossentropy\",\n",
|
||||||
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
" metrics=[\"accuracy\"])"
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -977,7 +984,8 @@
|
||||||
"for layer in model_B_on_A.layers[:-1]:\n",
|
"for layer in model_B_on_A.layers[:-1]:\n",
|
||||||
" layer.trainable = True\n",
|
" layer.trainable = True\n",
|
||||||
"\n",
|
"\n",
|
||||||
"model_B_on_A.compile(loss=\"binary_crossentropy\", optimizer=\"sgd\",\n",
|
"model_B_on_A.compile(loss=\"binary_crossentropy\",\n",
|
||||||
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
" metrics=[\"accuracy\"])\n",
|
" metrics=[\"accuracy\"])\n",
|
||||||
"history = model_B_on_A.fit(X_train_B, y_train_B, epochs=16,\n",
|
"history = model_B_on_A.fit(X_train_B, y_train_B, epochs=16,\n",
|
||||||
" validation_data=(X_valid_B, y_valid_B))"
|
" validation_data=(X_valid_B, y_valid_B))"
|
||||||
|
@ -1638,7 +1646,9 @@
|
||||||
" keras.layers.Dense(100, activation=\"selu\", kernel_initializer=\"lecun_normal\"),\n",
|
" keras.layers.Dense(100, activation=\"selu\", kernel_initializer=\"lecun_normal\"),\n",
|
||||||
" keras.layers.Dense(10, activation=\"softmax\")\n",
|
" keras.layers.Dense(10, activation=\"softmax\")\n",
|
||||||
"])\n",
|
"])\n",
|
||||||
"model.compile(loss=\"sparse_categorical_crossentropy\", optimizer=\"sgd\", metrics=[\"accuracy\"])"
|
"model.compile(loss=\"sparse_categorical_crossentropy\",\n",
|
||||||
|
" optimizer=keras.optimizers.SGD(lr=1e-3),\n",
|
||||||
|
" metrics=[\"accuracy\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue