The brain is arguably the most amazing thing on this planet. With our brains, humans have come up with some incredible inventions and created some amazing things. Even in the last century, the world has changed so much in such little time due to the development in computers and technology. But is it possible for computers to act like the human brain? To learn from it’s mistakes and from past experiences in order to continuously learn and improve? In short, yes! In this blog post, we will learn about what an artificial neural network is and it’s uses in machine learning, how it’s modelled after the human brain.
Let’s first dial it right back to basics. The image on the left shows three (not perfectly) handwritten images of the number 3. Somehow our brains are able to look at each of the images, process this information, and classify each of the images as the number 3. This is incredible. So we don’t actually have to be an artist and draw the number 3 perfectly each time to be able to recognise what each of the drawings represent.
When it comes to computers, we have to be very specific in what we tell them what to do, otherwise it just outputs absolute nonsense or just gives many many errors (as anyone who has done some programming understands).
Don’t see why this is important or of any relevance to your life? This concept of taking something that’s “kind of like” something else and being able to get a computer to understand and recognise what it is has lots of applications in many areas. Take Google translate for example.
The image on the right shows three handwritten versions of my surname, Li, written in traditional Chinese. As you can see, they are badly written and yet Google translate is able to interpret this and recognise what it is I am trying to write. This makes going to another country (pre and post-Covid) a lot more accessible for people that don’t know how to speak the language, allowing people to break down these language barriers and to connect. And this is just one application.
So how do computers do this? Well, it’s all to do with neural networks. In our brains, neurons are specialised cells that act as information messengers, using electrical impulses and chemical signals to send information between different areas of the brain. A basic image of a neuron is shown below. The main body of the neuron is where the information travels across. At the head and tail, we can the neuron branching off. These branches (or synapses) are where the neuron is receiving/sending information to/from other neurons. As we can see, there are multiple synapses, so the information is being sent and collected from many areas of the brain and this concept is applied to computers.
How does an artificial neural network work?
Let’s go through a simplified example of what an artificial neural network does. Let’s say the screen where we (badly) write our number on is actually a 28×28 square, where each point is a circle. This circle is called a neuron, and so there are 28×28=784 neurons. The image to the left shows this. Each neuron is able to hold a number between 0 and 1 and this is called it’s activation value. We can think of this as how much we have highlighted a specific neuron and holds our initial information.
We take all these 784 neurons and call this the input layer. Then, depending on which neurons are activated and have which activation value, we send this information across some synapses to activate neurons in the next layer, which then sends some information to neurons in another layer, and another layer, and so on. Then finally, we eventually get to the output layer, which just consists of just 10 numbers, each representing the numbers 0 to 9. The activation value for these neurons in the output layer represents the probability of that number being the number we initially wrote. So, the higher the activation number, the more likely the network believes that a particular number was our input number. The structure of this is shown in the picture below.
So we start off at the input layer, then we send some information to some intermediary layers (where the information sent changes depending on which neurons are activated), and then we finally get to the output layer where the program gives us a number it thinks we wrote. The intermediary layers are called hidden layers and we can think of this as all the fancy maths and calculations that go on in the background. In the image above, there are two hidden layers.
So imagine using Google translate. You write our name in chinese characters (the input layer), then google translate does some fancy stuff in the background (the hidden layers), and finally the app outputs what you think you wrote (the output layer).
The efficiency and accuracy in the network comes from how the information is sent from one layer to the next. As stated previously, the way a network sends information from one layer to the next depends on which neurons were activated beforehand and by how much, but is also determined by pre-specifying some numbers (which we call weights) along the edges. These weights tell us how strongly linked one neuron is in one layer to another neuron in the next. For example, if we draw a straight vertical line, we think the number is more likely to be a 1 rather than an 8 so we put more weight on the edge linking to the neuron representing the number 1.
But how do we determine the weights? This is where the “learning” part comes in. Once we have set up this network, we then trial it out by feeding it (lots of) handwritten numbers. Of course, we know what these numbers are and so we know what the output should be. So the network does all it’s calculations and give us the output of what it “thinks” the handwritten number is. If it’s wrong, then we can change the value of the weights so that next time, the network will perform better and will be less likely to make a mistake. This process is called training.
Conclusion
In conclusion, an artificial neural network acts like the neural network in our brains, taking in information and spots and classifies any patterns within the data. If the network makes a mistake, then it is able to “learn” from this mistake so that it can improve and do better next time. These artificial neural networks can be very large and complicated as we are looking to do more than just identify what number is written. However, this blog post explains the basic concept of an artificial neural network so you, the reader, are able to understand the basics of what they do and what it means for machines to “learn”. Thank you for taking the time to read. If you want to go into more detail, there is an excellent YouTube video here that explains this really well (and where I learnt all this from).