If you have any questions, refer to the FAQ first.
If you do not find a satisfactory answer, you can leave a message below :)
First, I apologize to you for not updating it for a long time.Article. Too many chores recently. Sorry.
1 Introduction
In the previous article, we have seen a simple application of Ann.ProgramIn this article, I will briefly introduce the most basic knowledge of ANN and the description of the Program Principles in the previous article.
2 Ann's most basic knowledge
AnnAlgorithmI believe you have a good understanding of how the biological nervous system works, and I will not detail it here. However, for the convenience of subsequent instructions, I would like to give you a question:
Figure 1
According to the working process of the biological nervous system, we can understand the meaning of the following figure:
Figure 2
You can imagine a situation in which, in the cold winter, we reach out to the fire, and slowly, you feel that you are about to fall asleep. At this time, suddenly I found my hand stretched over the stove very hot, and then immediately scaled back. This is an example of a neural network. The temperature produced by the fire opponent is the input layer (input) of Figure 2, and the scaled-down or not scaled-down is the output layer of Figure 2 ). But scale-down occurs only when the temperature in the hand reaches a certain level, for example, 40 degrees.
Figure 2 is used to represent the preceding situation:
X1 = temperature produced by fire opponents
W1 = the weight of the temperature produced by the fire opponent (to increase or decrease the temperature produced by the fire opponent, we make this value 1)
Activation function (active function) = If X1 * W1> 40 is activated (scaled down), otherwise it is restrained (not scaled down)
This is a single input. If multiple inputs exist, the output is F (x1 * W1 + x2 * W2 + X3 * W3 ...)
F (x) is the activation function.
Next, let's look at the structure of two multi-input neural networks:
And Operation
F (x) =
If (x> = 2) return 1;
Else return 0;
The threshold is 2.
We can use this structure to check whether it is correct:
X1 = 0, X2 = 0, x = x1 * W1 + x2 * W2 = 0 f (x) = 0; correct
X1 = 0, X2 = 1, x = x1 * W1 + x2 * W2 = 1 f (x) = 0; correct
X1 = 1, X2 = 0, x = x1 * W1 + x2 * W2 = 1 f (x) = 0; correct
X1 = 1, X2 = 1, x = x1 * W1 + x2 * W2 = 2 f (x) = 0; correct
Or operation
F (x) =
If (x> = 1) return 1;
Else return 0;
The threshold is 1.
We can use this structure to check whether it is correct:
X1 = 0, X2 = 0, x = x1 * W1 + x2 * W2 = 0 f (x) = 0; correct
X1 = 0, X2 = 1, x = x1 * W1 + x2 * W2 = 1 f (x) = 1; correct
X1 = 1, X2 = 0, x = x1 * W1 + x2 * W2 = 1 f (x) = 1; correct
X1 = 1, X2 = 1, x = x1 * W1 + x2 * W2 = 2 f (x) = 1; correct
The above two examples are a neural network model that needs to be created in my previous article.
But how do we determine W1, W2 and threshold?
This requires learning through neural networks to determine W1, W2 and threshold values.
2. Learning
For the calculation and model, two inputs and one output are required. The key is how to determine the two input weights and the activation function thresholds.
To calculate the threshold value of the activation function, we can add an input layer to make it look like this.
In this way, we only need to make the activation function f (x) =
If (x> = 1) return 1;
Else return 0;
You can. The value of W3 can be determined based on the threshold value. In this way, the original problem becomes the problem of solving the sizes of W1, W2, and W3.
Next, we will formulate such a learning rule:
W (I) = W (I) + (correct value-actually calculated value) * X (I ).
After a certain number of training, we can make the (correct value-actually calculated value) quite a bit, so that the final result will be stable, and we can find the W1 we need, an approximate value of W2, W3.
3. Actual Execution Process
- Get the training set (reasonable input and expected output (for example, input X1 = 1, X2 = 1 Output 1 ))
- Assign random values to W1, W2, and W3.
- Perform a certain number of training
4Notice
In the next article, I will introduce a multi-layer Neural Network for computing XOR (exclusive or) operations.
5Summary
In this article, we will introduce the simplest and most basic principles of neural networks and the example principles in the previous article.