MNIST Classifier
Machine Learning is self explanatory, it is a process in which the computer gains the ability to learn on its own.
In this project we will look at the concept behind neural networks to teach a computer to analyse hand-written single digit numbers and be able to predict the number shown.
Layers:
- Input Layer: 28x28 pixel images, each denoting a certain number, summing up to 784 pixels or neurons.
- Hidden Layers: Further analysis in the images such as edges, lines and circles.
- Output Layer: 10 neurons decoding values from 0-9, the prediction layer.
Let's jump into the concepts. We have 3 stages, together called gradient descent;
- Forward Propagation
- Backward Propagation
- Update of Parameters
Forward Propagation:
We will be taking the 784 input neurons each with values between 0 and 1 depending on the brightness of the neuron. Take these values as "X".
Next, each neuron is given a random weight("W") which is multiplied with "X" and added with a bias(activation occurs only when weighted sum W1X1+W2X2+....+WnXn is above the bias("b")).
This sum of weighted sum with bias are put inside an activation function such as ReLU to get values between 0 and 1, giving us "a".
Backward Propagation:
Now each activation would have a value which most probably is not the right value (0 or 1) hence we get its Cost(how far off "a" is from the right value):
(a-k)^2; where "k" is either 0 or 1
The average of all the cost functions("C") are used for further steps.
Update of Parameters:
Now all the parameters("W","b") are updated with respect to "C" and a learning factor("l").
Perform gradient descent till it closes on to the right values.
Repeat the cycle with a significant number of training images to maximise prediction accuracy.