Let us now get started on the backpropagation algorithm:
- Import the modules:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
- Load the dataset; we use one-hot encoded labels by setting one_hot = True:
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
- Define hyperparameters and other constants. Here, each handwritten digit is of the size 28 x 28 = 784 pixels. The dataset is classified into 10 categories, as digits can be any number between 0 to 9. These two are fixed. The learning rate, the maximum number of epochs, the batch size of the mini batch to be trained, and the number of neurons in the hidden layer are the hyperparameters. One can play around with them to see how ...