MNIST Handwritten Digit Classifier

An implementation of multilayer neural network using numpy library. The implementation is a modified version of Michael Nielsen's implementation in Neural Networks and Deep Learning book.

Brief Background:

If you are familiar with basics of Neural Networks, feel free to skip this section. For total beginners who landed up here before reading anything about Neural Networks:

Sigmoid Neuron

Note: There are other functions in use other than sigmoid, but this information for now is sufficient for beginners.

Why a modified implementation ?

This book and Stanford's Machine Learning Course by Prof. Andrew Ng are recommended as good resources for beginners. At times, it got confusing to me while referring both resources:

MATLAB has 1-indexed data structures, while numpy has them 0-indexed. Some parameters of a neural network are not defined for the input layer, so there was a little mess up in mathematical equations of book, and indices in code. For example according to the book, the bias vector of second layer of neural network was referred as bias[0] as input layer (first layer) has no bias vector. I found it a bit inconvenient to play with.

I am fond of Scikit Learn's API style, hence my class has a similar structure of code. While theoretically it resembles the book and Stanford's course, you can find simple methods such as fit, predict, validate to train, test, validate the model respectively.

Naming and Indexing Convention:

I have followed a particular convention in indexing quantities. Dimensions of quantities are listed according to this figure.

Small Labelled Neural Network

Layers

Weights

Biases

'Z's

Activations

Execution of Neural network

#to train and test the neural network algorithm, please use the following command
python main.py