How is a neural network
Let's save time and imagine that you heard about neural networks, know about their advantages and want to learn how to use them.
At the same time, you ran into educational articles. Everything was incomprehensible. From the very first pages, they began to load with integrals and gradient descents. You decided to go on courses. It’s even worse there. The course took 4-12 months. And it was like an airplane wing: 100-200 thousand rubles. Well, such a small wing. Yes, and motivation below the plinth without magic kicks from the teacher.
All you wanted to do was get HelloWorld , but for neural networks. That is, the simplest application demonstrating the basic principles of work. Voila! You are on the right track!
A bit of theory. A neural network is column .
But unlike Monte Cristo, it has an input S-layer (touch) . There we give numbers in the interval [0.1]. For example, a picture with a cat. We take each point, convert it to gradation of gray and write to the input node according to the rule, where 0 is white, and the closer to 1, the darker the thoughts at our point.
Further intermediate - A-associative layers . They also contain the values [0.1]. They are connected by edges with the previous and subsequent layers. The weights of the edges are within [0.1], given arbitrarily. The value of the A-layer node is the sum of the products of the weights of neurons and the weights of the edges. The resulting amount may turn out to be more than 1, so it is “normalized” so that it falls into the interval [0.1]. To do this, use activation functions .
Finally, the last, or as the sailors would say, “extreme” - R-reacting layer . The calculation rules are the same as for A-layers.
The result is such a guy, or rather, perceptron :
So. We apply tsiferki to the input of the neural network. Further, from input to output, we calculate the values taking into account the fed signals to the nodes, the weights of the edges, and the activation functions of the layers. At the output we get the values. Suppose we have 1 output node and its value is 0.5. And we would like its value to be 1. Because we agreed that 1 on the node means that there is a cat in the photo. How to change the weights of the edges to get 1 at the output?
For this, a particularly strong witchcraft is used - Error Propagation Method . The point is to change the edge weights from right to left (from R-layers to S-layers) so that the desired values are obtained at the output. If you do so many times for different pictures, then gradually, the neural network will “learn” to recognize the image that we want. Read more read the wiki and the original article " A Step by Step Backpropagation Example "by Matt Mazur . By the way, I also posted a picture with an example implementation on a wiki.
Here, by the way, and she:
Well, in principle, that's all! You can consider yourself Junior Data Science and don’t agree to a salary of less than 300 thousand rubles! Of course, there are many more things you should know:
- Is it necessary to write such a graph every time from scratch? Of course not! There are many libraries to help create a one-click neural network: Keras , TensorFlow , PyTorch , thousands of them ! Choose based on functionality, popularity and a familiar programming language.
- Where to get datasets for neural networks? Well, look them up at Kaggle , Wiki , Habré , assemble it yourself, in the end! Hint - the smartphone collects clouds of data about you through mobile applications, the included microphone and GPS-sensor.
- How to choose the graph architecture - the number of layers, nodes, edges, activation and error functions, a library for processing? Argh! In this and the work is done datasaens!
- I will make an AI application and investors will give me 100 lyam, take me to the valley, will Zuckerberg call? Lol, no! Neural networks are just a tool for a certain class of tasks. Solve the real problem , and not like last time. It’s completely fire if you get into the trend .
What about the promised HelloWorld? I have them!
- Neural network from Matt Mazur's article in C #
- Neural network for recognizing handwritten digits of the MNIST base with an accuracy of 91% in C #
- XOR neural network on Keras.NET, Numpy.NET and C #
- Neural network MNIST on Keras.NET and C #
- MNIST recognition neural network with manually loading data into C #
Well, that’s enough. More examples of are in the book . And google in general heaps !.