How to Program a Neural Network




In this article, we will build a neural network from scratch and use it to classify handwritten digits.

Why reinvent the wheel/neural network, I hear you say? Can’t I just use my favourite machine learning framework and be done with it? Yes, there are many off-the-shelf frameworks that you can use to build a neural network (Keras, PyTorch, and TensorFlow to name a few). The thing with using one of these is that they make it easy for us to treat neural networks like black boxes.

This isn’t always a bad thing. Often we need this level of abstraction so that we can get to work on the problem at hand, but we should still strive to at least have a basic understanding of what is going on under the hood if we are to use neural networks in our work.

Building a neural network from scratch is, in my opinion, the best way to foster a deep understanding of how they work.

By the end of this article, you will have learned about the feedforward and backpropagation algorithms, what an activation function is, what the difference between an epoch and a batch is, and how to train a neural network. We will finish with an example by training a neural network to recognise handwritten digits.