[PYTHON] [For beginners] Super introduction to neural networks that even cats can understand

IMG_0489.png

What is written

  1. What is a neural network?
  2. Unit? weight? bias?
  3. Activation function
  4. Overview of NN
  5. Summary

The goal is to get a fluffy understanding of the big picture of neural networks. I don't use mathematical formulas, so please take a look even if you are allergic to mathematics.

1. What is a neural network?

IMG_0490.png

A neural network is something like the one below. Since it is a Neural Network when written in English, it is often abbreviated as NN. So this time I will explain with NN

IMG_0491.png

The round one is called a "unit", and the line connecting the units is called a "synapse". Since it is troublesome to call it a synapse, let me explain it by calling it a "line" this time.

IMG_0492.png

NN has a layered structure. Generally, the first layer and the second layer from the left are counted. The first layer is called the "input layer", the last layer is called the "output layer", and the spaces are collectively called the "intermediate layer (hidden layer)". Below is a 4-layer NN diagram.

IMG_0493.png

2. Unit? weight? bias?

IMG_0494.png

Let's take a closer look. The round one is called a "unit". The unit has one number.

IMG_0495.png

Units are sometimes called "neurons". It's OK to recognize that all of Soyu's are "round ones".

IMG_0496.png

The number of a unit goes through a "line" (synapse) to the next unit. The numbers will be added to the next unit.

IMG_0497.png

The value changes as you pass through the line. For example, as shown below, when the number "3" of the previous unit passes through the line, "x2" is calculated and "6" is added to the next unit. This "x2" is called "weight". It is an image that the line has the number x2.

IMG_0498.png

The value of "weight" is different for each line. For example, if one unit is connected to three next units, as shown below, the numbers will advance along the three lines.

IMG_0499.png

Consider the case where the three lines have "weights" of x2, x-4, and x3, respectively. The "3" of the previous unit is multiplied by each "weight" and added to the next unit.

IMG_0500.png

The figure below shows the time when three previous units are connected to one next unit. In this case as well, the results of "13 * 2", "-2 * -4", and "-9 * 3" are added one after another, and the value of the next unit becomes "7".

IMG_0501.jpeg

And again, it feels like that "7" is moving on to the next unit.

IMG_0502.jpeg

The NN is calculated as described above. Overall, if you put a number in the "input layer" of NN, various calculations will be done through NN and the result will come out in the "output layer".

IMG_0503.jpeg

In the input layer, enter the "data" that you want artificial intelligence to learn, but in the NN, also enter "numbers other than data". This is called "bias".

IMG_0504.jpeg

Bias is an image attached to each layer, as shown in the image below. To be precise, each unit has one different bias.

IMG_0505.jpeg

When the number of the previous unit is added to the next unit, this "bias" number is also added. The bias line has no weight.

IMG_0506.jpeg

3. Activation function (Kaseikakansu)

IMG_0507.jpeg

There is one more rule. The unit numbers change just before going to the line. The image looks like the image below.

IMG_0508.jpeg

The value of this changes according to the rule of "activation function". There are many types of activation functions, but the most famous is the activation function called "ReLU function".

IMG_0509.jpeg

The ReLU function is a rule that "if the unit value is 0 or less, change it to 0, and if it exceeds 0, pass it as it is".

IMG_0510.jpeg

The value of the unit changed in this way advances to the line.

IMG_0511.jpeg

Organize it. As a flow, The value of the unit changes according to the rules of the activation function → it changes again when the number passes through the synapse (line) → the number and bias are added to the next unit more and more.

IMG_0512.jpeg

By the way, changing the value depending on the activation function is called "activating".

4. Overview of NN

IMG_0513.jpeg

If you enter a number in the "input layer" of NN, various calculations will be performed through NN and the result will appear in the "output layer".

IMG_0514.jpeg

In detail, The value of the unit changes according to the rules of the activation function → it changes again when the number passes through the synapse (line) → the number and bias are added to the next unit more and more.

IMG_0515.jpeg

In addition, the synapse "weight (x how many times)" and "bias" are initially set to random values.

IMG_0516.jpeg

Updating this number steadily is called "learning". By updating the "weight" and "bias", the goal of NN is to create a nice output.

IMG_0517.jpeg

5. Summary

IMG_0518.jpeg

I explained the basic flow of NN. It's the basics of the basics, so all you have to do is get a rough idea of the image.

that's all! Have a nice NN life!

Learn more about artificial intelligence / AI / machine learning

Youtube宣伝画像.jpeg

** "AI for cat allergies" ** https://t.co/4ltE8gzBVv?amp=1 We publish about machine learning on YouTube. If you have time, please take a look.

created by NekoAllergy

Recommended Posts

[For beginners] Super introduction to neural networks that even cats can understand
An introduction to Word2Vec that even cats can understand
An introduction to Python that even monkeys can understand (Part 3)
An introduction to Python that even monkeys can understand (Part 1)
An introduction to Python that even monkeys can understand (Part 2)
A disocrd bot that even beginners can regularly post Splatoon 2 results to stat.ink for free
8 services that even beginners can learn Python (from beginners to advanced users)
Recurrent Neural Networks: An Introduction to RNN
Beginners read "Introduction to TensorFlow 2.0 for Experts"
Python for super beginners Python for super beginners # Easy to get angry
Introduction to Programming (Python) TA Tendency for beginners
[For beginners] Introduction to vectorization in machine learning
Automatic browser operation that even beginners can do
Understand Python for Pepper development. -Introduction to Python Box-
Even beginners want to say "I fully understand Python"
How to convert Python # type for Python super beginners: str
Python # How to check type and type for super beginners
[Explanation for beginners] Introduction to convolution processing (explained in TensorFlow)
[Explanation for beginners] Introduction to pooling processing (explained in TensorFlow)
How to convert Python # type for Python super beginners: int, float
[Python] Introduction to graph creation using coronavirus data [For beginners]
SIR model that even junior high school students can understand
[Django] A brief summary of the log output function so that even beginners can understand it.
Easy-to-understand explanation of Python Web application (Django) even for beginners (5) [Introduction to DB operation with Django shell]
[Python] I tried to explain words that are difficult for beginners to understand in an easy-to-understand manner.
A super introduction to Linux
Python #function 2 for super beginners
Python for super beginners Python #functions 1
Python #list for super beginners
~ Tips for beginners to Python ③ ~
Super introduction to machine learning
Introduction to Python For, While
[Thorough explanation] How to understand functions (methods) that beginners must see
An introduction to Pandas that you can learn while suffering [Part 1]
[Unity] How to run ML-Agents Release 8 even for transcendental beginners [Windows]
[For beginners] Recursive function (Tower of Hanoi is easy to understand!)
Easy-to-understand explanation of Python web application (Django) even for beginners (4) [Routing settings / Introduction to MTV design patterns]