You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/tutorial-deep-learning-on-mnist.md
+115-127
Original file line number
Diff line number
Diff line change
@@ -360,14 +360,14 @@ def relu2deriv(output):
360
360
**3.** Set certain default values of [hyperparameters](https://en.wikipedia.org/wiki/Hyperparameter_(machine_learning)), such as:
361
361
362
362
-[_Learning rate_](https://en.wikipedia.org/wiki/Learning_rate): `learning_rate` — helps limit the magnitude of weight updates to prevent them from overcorrecting.
363
-
-_Epochs (iterations)_: `epochs` — the number of complete passes — forward and backward propagations — of the data through the network. This parameter can positively or negatively affect the results. The higher the iterations, the longer the learning process may take.
363
+
-_Epochs (iterations)_: `epochs` — the number of complete passes — forward and backward propagations — of the data through the network. This parameter can positively or negatively affect the results. The higher the iterations, the longer the learning process may take. Because this is a computationally intensive task, we have chosen a very low number of epochs (20). To get meaningful results, you should choose a much larger number.
364
364
-_Size of the hidden (middle) layer in a network_: `hidden_size` — different sizes of the hidden layer can affect the results during training and testing.
365
365
-_Size of the input:_`pixels_per_image` — you have established that the image input is 784 (28x28) (in pixels).
366
366
-_Number of labels_: `num_labels` — indicates the output number for the output layer where the predictions occur for 10 (0 to 9) handwritten digit labels.
# 3. Display the error and accuracy metrics in the output.
472
+
print("\n" + \
473
+
"Epoch: " + str(j) + \
474
+
" Training set error:" + str(training_loss/ float(len(training_images)))[0:5] +\
475
+
" Training set accuracy:" + str(training_accurate_predictions/ float(len(training_images))) +\
476
+
" Test set error:" + str(test_loss/ float(len(test_images)))[0:5] +\
477
+
" Test set accuracy:" + str(test_accurate_predictions/ float(len(test_images))))
487
478
```
488
479
489
480
The training process may take many minutes, depending on a number of factors, such as the processing power of the machine you are running the experiment on and the number of epochs. To reduce the waiting time, you can change the epoch (iteration) variable from 100 to a lower number, reset the runtime (which will reset the weights), and run the notebook cells again.
@@ -493,32 +484,29 @@ The training process may take many minutes, depending on a number of factors, su
493
484
After executing the cell above, you can visualize the training and test set errors and accuracy for an instance of this training process.
494
485
495
486
```{code-cell} ipython3
496
-
:tags: [raises-exception, hide-output]
497
-
498
-
if execute_training:
499
-
# The training set metrics.
500
-
y_training_error = [store_training_loss[i]/float(len(training_images)) for i in range(len(store_training_loss))]
axes[0].plot(x_training_accuracy, y_training_accuracy, label = "Training set accuracy")
503
+
axes[0].plot(x_training_error, y_training_error, label = "Training set error")
504
+
axes[0].set_xlabel("Epochs")
505
+
axes[1].set_title('Test set error, accuracy')
506
+
axes[1].plot(x_test_accuracy, y_test_accuracy, label = "Test set accuracy")
507
+
axes[1].plot(x_test_error, y_test_error, label = "Test set error")
508
+
axes[1].set_xlabel("Epochs")
509
+
plt.show()
522
510
```
523
511
524
512
The accuracy rates that your model reaches during training and testing may be somewhat plausible but you may also find the error rates to be quite high.
0 commit comments