5th December 2013 · By Lee Jacobson

Introduction to Artificial Neural Networks - Part 1

This is the first part of a three part introductory tutorial on artificial neural networks. In this first tutorial we will discover what neural networks are, why they’re useful for solving certain types of tasks and finally how they work.

Introduction

Computers are great at solving algorithmic and math problems, but often the world can’t easily be defined with a mathematical algorithm. Facial recognition and language processing are a couple of examples of problems that can’t easily be quantified into an algorithm, however these tasks are trivial to humans. The key to Artificial Neural Networks is that their design enables them to process information in a similar way to our own biological brains, by drawing inspiration from how our own nervous system functions. This makes them useful tools for solving problems like facial recognition, which our biological brains can do easily.

How do they work?

First lets take a look at what a biological neuron looks like.
Biological Neuron
Our brains use extremely large interconnected networks of neurons to process information and model the world we live in. Electrical inputs are passed through this network of neurons which result in an output being produced. In the case of a biological brain this could result in contracting a muscle or signaling your sweat glands to produce sweat. A neuron collects inputs using a structure called dendrites, the neuron effectively sums all of these inputs from the dendrites and if the resulting value is greater than it’s firing threshold, the neuron fires. When the neuron fires it sends an electrical impulse through the neuron’s axon to it’s boutons. These boutons can then be networked to thousands of other neurons via connections called synapses. There are about one hundred billion (100,000,000,000) neurons inside the human brain each with about one thousand synaptic connections. It’s effectively the way in which these synapses are wired that give our brains the ability to process information the way they do.

Modeling Artificial Neurons

Artificial neuron models are at their core simplified models based on biological neurons. This allows them to capture the essence of how a biological neuron functions. We usually refer to these artificial neurons as ‘perceptrons’. So now lets take a look at what a perceptron looks like.
Perceptron
As shown in the diagram above a typical perceptron will have many inputs and these inputs are all individually weighted. The perceptron weights can either amplify or deamplify the original input signal. For example, if the input is 1 and the input’s weight is 0.2 the input will be decreased to 0.2. These weighted signals are then added together and passed into the activation function. The activation function is used to convert the input into a more useful output. There are many different types of activation function but one of the simplest would be step function. A step function will typically output a 1 if the input is higher than a certain threshold, otherwise it’s output will be 0.

Here’s an example of how this might work:
Input 1 (x1)  = 0.6
Input 2 (x2)  = 1.0

Weight 1 (w1) = 0.5
Weight 2 (w2) = 0.8

Threshold = 1.0


First we multiple the inputs by their weights and sum them:
x1w1 + x2w2 = (0.6 x 0.5) + (1 x 0.8) = 1.1


Now we compare our input total to the perceptron’s activation threshold. In this example the total input (1.1) is higher than the activation threshold (1.0) so the neuron would fire.

Implementing Artificial Neural Networks

So now you’re probably wondering what an artificial neural network looks like and how it uses these artificial neurons to process information. In this tutorial we’re going to be looking at feedforward networks and how their design links our perceptron together creating a functioning artificial neural network. Before we begin lets take a look at what a basic feedforward network looks like:
Artificial Neural Network
Each input from the input layer is fed up to each node in the hidden layer, and from there to each node on the output layer. We should note that there can be any number of nodes per layer and there are usually multiple hidden layers to pass through before ultimately reaching the output layer. Choosing the right number of nodes and layers is important later on when optimising the neural network to work well a given problem. As you can probably tell from the diagram, it’s called a feedforward network because of how the signals are passed through the layers of the neural network in a single direction. These aren’t the only type of neural network though. There are also feedback networks where its architecture allows signals to travel in both directions.

Linear separability

To explain why we usually require a hidden layer to solve our problem, take a look at the following examples:
Linearly Separability
Notice how the OR function can be separated on the graph with a single straight line, this means the function is “linearly separable” and can be modelled within our neural network without implementing a hidden layer, for example, the OR function can be modeled with a single perceptron like this:
OR Function
However to model the XOR function we need to use an extra layer:
XOR Function
We call this type of neural network a ‘multi layer perceptron’. In almost every case you should only ever need to use one or two hidden layers, however it make take more experimentation to find the optimal amount of nodes for the hidden layer(s).

To be continued...

So now you should have a basic understanding of some of the typical applications for neural networks and why we use them for these purposes. You should also have a rough understanding of how a basic neural network operates and how it can process data. In the next tutorial we will be looking at ways to construct a neural network and then how we can ‘train’ it to do the things we want it to do.

Part 2 is now available here, Introduction to Artificial Neural Networks Part 2 - Learning

Author

Lee JacobsonHello, I'm Lee.
I'm a developer from the UK who writes about technology and startups. Here you'll find articles and tutorials about things that interest me. If you want to hire me or know more about me head over to my about me page

Social Links

Tags

Comments

blog comments powered by Disqus