If you have followed Fabio’s posts up until now, you should be familiar with the basic blocks of a Torch application.
In this iTorch notebook, we will see a simple but complete example of neural network for the classification problem of recognizing handwritten digits. We use the standard MNIST dataset, which consists of 60000 grayscale images of size 28x28. We will build a recognizer as a neural network with an input of 28x28=764 neurons and an output of 10 numbers representing the (log-)probabilities that we assign to the 10 digits.
The model, as implemented here, is very shallow and only has 30 neurons in the (only) hidden layer; hence the precision achieved is very low. Try experimenting by changing the size and architecture of the network, the training parameters and the initialization of the layers to get a feeling of how the training time changes, and how the precision is affected.