fig, (ax1, ax2) = plt.subplots(1, 2, sharey=True, figsize=(16, 5))
nn_plot(hist[1], 100, subplot=ax1, loss=True, title="Reference: eta 0.5")
nn_plot(hist[3], 100, subplot=ax2, loss=True, title="eta 0.01")
fig, (ax1, ax2) = plt.subplots(1, 2, sharey=True, figsize=(16, 5))
nn_plot(hist[1], 100, subplot=ax1, acc=True, title="Reference: eta 0.5")
nn_plot(hist[3], 100, subplot=ax2, acc=True, title="eta 0.01")
We will try one more value for $\eta = 0.025$. The comparison will be with $\eta = 0.01$ since the previous result converged.
model.append(tf.keras.models.Sequential([
tf.keras.layers.Dense(30, kernel_regularizer=tf.keras.regularizers.l2(0.01),
activation=tf.nn.sigmoid, input_shape=(784,), name='hidden_1_layer'),
tf.keras.layers.Dense(10, activation='softmax', name='output_layer')
]))
params.append([tf.keras.losses.SparseCategoricalCrossentropy(),
tf.optimizers.SGD(learning_rate=0.025),
tf.keras.metrics.SparseCategoricalAccuracy()])
nn_compile(model[-1], params[-1])