Machines already know how to find faces in photographs, search for terrorists in a video stream, translate texts and understand sound commands. Neural networks that replicate the structure of the brain are an elementary piece of any complex algorithm. From the lecture you will learn how all this is connected with equations, inequalities and derivatives, what interesting discoveries have happened lately, and what you should start programming now, one day to become an expert in the psychology of robots.
')
If you recall the movie "Terminator" and the technologies that cyborg used in the story, you can select both neural networks and the ability to wirelessly communicate with an external source of intelligence (Skynet), computer vision, sound recognition, and understanding of various languages. At the time of the film's release on screens, all this was absolute fiction, the technology of the distant future. But today, most of these technologies are implemented in one form or another. Let's try to figure out what of all the above is already used.

In the picture above you can see the result of the work of a completely autonomous recognition algorithm. Almost all objects in the picture are recognized correctly. As for voice recognition, almost every smartphone owner has come across them nowadays: voice input of search queries and voice commands to a GPS navigator no longer seem something unusual. Due to the transition to a statistical model, over the past couple of decades, machine translation technologies have also advanced very far and have become part of our lives. In most cases, these technologies apply data transfer to a server that recognizes, translates, or otherwise processes the data. So, wireless communication with external intelligence is already implemented and widely used.
But let's move away from the "Terminator" and try to determine what is meant by artificial intelligence, and at what point we can say with confidence that the machine has become equal in intelligence to man. The well-known Turing test immediately comes to mind, in which a person needs to determine with whom he communicates: with a person or a machine.
How smart computers work
Human thinking is based on networks of neurons in the brain. These neurons inspired scientists to create an artificial neuron. An artificial neuron receives several values at the input with different weights, depending on the importance of the incoming connection. The neuron performs weighted summation and gives the predicted value and makes some decision:

If we represent a neuron as a classifier of points in three-dimensional space, then for each point, the weighted sum of which will be positive, it will assign the value 1, and those, for which the weighted sum is negative, is -1. Suppose we have a neuron with two inputs, then the weighted sum will be the equation of a line in the plane.

If the signal is to the right of the straight line, it turns blue, and if to the left, it turns red. A neuron paints a part of the plane into a plus, and a part of the plane into a minus. Thus, we have a way to train artificial neurons. Suppose we have a certain number of points about which we know whether they are plus or minus. We take our neuron and due to the manipulation of the weights, we get every time a new equation of the plane. And we select this equation of the plane so that all the blue points are on one side of the line, and all the red ones are on the other.

If we are lucky, we will be able to separate them exactly so that not a single point remains on the wrong side. But this is not always the case, so we need to strive to ensure that on one side there are more blue dots, and on the other - more red ones. We will try to describe it from the point of view of mathematics. Mathematics is well able to search for maxima of functions, for which it is necessary to find a point where the derivative is zero. We can take a sigmoid - a function close to our indicator, but from which we can extract the derivative. It can be differentiated and the full power of mathematical analysis can be used to solve our problem.

If we take y
i for the correct values, and x
i for the incoming values, then we can get this square:

We can differentiate this function, which means we can find its minimum, since this is an error - the deviation of the real values from the predicted values. So you can train the neuron, which is quite well separated points.
Thanks to this algorithm, very good results were achieved, in particular, in letter recognition. Suppose we have a grid of five to five cells - twenty-five cells. For each cell, we can calculate what percentage of the cell is full. We give the resulting 25 values to the input of one neuron. By training a neuron using our algorithm, we can recognize all the letters of the alphabet.

However, this all works only as long as the letters are exactly in the grid. Due to too many letter layout options, the algorithm can no longer cope with recognition. How can this problem be solved? The first thing that comes to mind is to try instead of a grid to use a set of some distinctive features for letters. We will not look at the letter as 25 pixels, but as a set of characteristics that do not depend on turns. For example, consider it as a graph, pull out the vertices of the first degree, the second degree, the third degree, pull out the cycles.

Neural network

If we take three values and send each of them to three neurons of the first layer, each of them will calculate the weighted sum, calculate the sigmoid and forward it to the next layer, in the end they will all be collected on the output neuron, which will build the predicted value. Why do you need it? Our brain is approximately so organized: neurons are connected with each other, they have input and output branches. Such is trained is approximately as follows:

Having watched the
lecture to the end, you will learn exactly how neural networks are trained, what architectures they have, why matane is good, and function is even greater good, what cellular automata are and how robots are trained.