Showing posts with label GitHub. Show all posts
Showing posts with label GitHub. Show all posts

Friday, September 29

Programming 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.

All code used in this article is available here on GitHub 

What is a neural network?
Neural networks, or artificial neural networks, are a type of machine learning algorithm. They form the core of many deep learning and artificial intelligence systems like computer vision, forecasting and speech recognition.

The structure of artificial neural networks is sometimes compared to the structure of biological neural networks in the brain. I would always urge caution not to draw too much from this comparison. Sure, artificial neural networks look a bit like biological neural networks but it is quite a big leap to start comparing them to something as complex as a human brain.

A neural network is made up of several layers of neurons. Each layer of neurons is activated based on the activations in the previous layer, a set of weights connecting the previous…  READ MORE...