Artificial Neural Networks
In the case of artificial neurons, the sum of the inputs multiplied by their associated weights determines the “nerve impulse” that the neuron receives. This value is processed inside the cell by an activation function that returns a value that is sent as the neuron’s output.
Just as our brain is made up of interconnected neurons, an artificial neural network is made up of interconnected artificial neurons grouped into different levels that we call layers:
» A layer is a set of neurons whose inputs come from a previous layer (or from the input data in the case of the first layer) and whose outputs are the input of a subsequent layer.»
In the following image we can see a red one with four layers:
The neurons in the first layer receive as input the actual data that feeds the neural network. This is why the first layer is known as the input layer. The output of the last layer is the visible result of the network, so the last layer is known as the output layer. The layers between the input layer and the output layer are known as hidden layers since we do not know both the input and output values.
A neural network, therefore, is always composed of an input layer, an output layer (if there is only one layer in the neural network, the input layer matches the output layer) and can contain 0 or more hidden layers. The concept of Deep Learning is born from using a large number of hidden layers in networks.
How do you train a neural network?
Training a neural network involves adjusting each of the input weights of all the neurons that make up the neural network, so that the output layer's responses fit as closely as possible to the data we know.
In the following animation, we can see a very simplified example of the training process of a network to detect, in this case, a cat in an image. The thickness of each arrow represents the weight that that input has in the neural network. As we can see, as the weights are adjusted, the error decreases.
If we want the neural network to be able to generalize and identify cats in any image, it is important to use a large number of images for training, both images that are cats (labeled as 1) and images that are not cats (labeled as 0), including as much variability as possible. With this, the network will be able to adjust its parameters to satisfy as much as possible all the images, so it will be able to accurately extract the features that identify the presence of a cat in an image.