Neural Networks and Deep Learning

I mentioned earlier that, by organising artificial neurons in several layers, you can overcome the limit of linearity. Rosenblatt’s simple perceptron, which at the time seemed to promise miracles, is today nothing more than a basic exercise for anyone who wants to start studying neural networks. But what actually is this artificial neuron? Let’s start with what inspired the way it works: the biological neuron. Let’s look at a representation of one:

Really not pretty to look at. Luckily, the way it works is so simple that at least it will win you over. There are three main elements: the dendrites are the neuron’s entry points, and their job is to receive input from the other connected neurons (the famous on/off signals in McCullock and Pitts’ insight). Transmission happens through an electrical impulse. Amazing, isn’t it? We’re a bit like machines ourselves.
The electrical signals reach the nucleus, which decides whether or not to activate the neuron. The nucleus takes the signals from the other neurons, performs a sort of mysterious calculation and decides whether to switch on or stay off. The decision is passed to the axon which, through its terminals, hands it on to the other connected neurons. If you consider that our brain contains around 86 billion neurons, you can imagine what a fine “network” of interconnected neurons will form, in which the activation of one can lead to the activation (or deactivation) of billions of other neurons.
But let’s go back to our single neuron and see how we might try to design an artificial one that can somehow reproduce the activity of the biological one:

That’s already nicer than the biological one. Here too we have the three main components: the input data (which can also be the outputs of other neurons), emulating the activity of the dendrites; the nucleus, which decides whether or not to switch the neuron on; and one or more axons, which inform the neurons connected to this one. What remains is to model the problem mathematically.
Our heroic researchers imagined the activity of the nucleus as that of an “adder”, a simple entity that takes the data received as input, processes it, for example by multiplying each value by a different number that we’ll call a weight, and then adds them up. If the data received from, say, three neurons (or any three inputs) are x1, x2 and x3, by multiplying each of these by its respective weight w1, w2 and w3 and finally adding up the results, we can sketch our neuron as:

The result of the artificial neuron’s activity is therefore the “sum of these multiplications”. This sum is used to decide whether or not the neuron should switch on, following rules set by an activation function. The simplest activation function is the threshold function: if the result of the weighted sum exceeds a certain value, the neuron switches on; otherwise it switches off. So, in the end, you can picture the model like this:

If you think about it, what it does is really elementary. Let’s try to sum it up in a few points:
- Take each input value xi and multiply it by its own weight wi.
- Add up the results of all the multiplications.
- Use an activation function to determine the output y.
Done. Really, I’m not joking: this is what an artificial neuron does, at least when it is running. Of course, we haven’t yet touched on the more complicated training phase (remember? The perceptron had to be trained to learn to recognise something, however simple), which consists of finding the right values to assign to the weights wi, so that the inputs xi multiplied by these weights produce the expected output. Every neural network works this way, and every neural network is trained to find the “optimal” weights. What changes is the number of weights, which can reach several million, and the organisation of the network, which can end up containing millions of neurons.
Taken from the book “Intelligenza Artificiale – Guida per comuni mortali” (Artificial Intelligence – A Guide for Mere Mortals)
Try it yourself
An interactive demo of the ideas in this article: you can use it right here on the page.
Also try: Neural network vs XOR
Another interactive demo related to this page.