News classification
Contact us
- Add: No. 9, North Fourth Ring Road, Haidian District, Beijing. It mainly includes face recognition, living detection, ID card recognition, bank card recognition, business card recognition, license plate recognition, OCR recognition, and intelligent recognition technology.
- Tel: 13146317170 廖经理
- Fax:
- Email: 398017534@qq.com
How does deep learning neural network give prediction results?
How does deep learning neural network give prediction results?
This chapter introduces a prediction algorithm -- logistic regression.
Given an input feature vector x (such as the image you want to recognize - whether there is a cat), you need an algorithm to calculate the output after the calculation (in this case we use a logical regression algorithm). This is the output of the prediction we called y^y^, if y is 1, if the prediction is then y^y^ may be 0.99).
The X in the first formula in the first figure is a matrix (n, 1) dimension, which represents a training sample, and the N in it represents the number of features in a training sample. For example, a picture is a training sample, and each color intensity value is a feature; W is a matrix of (n, 1) dimension, which represents the weight (weight), which corresponds to each input feature, and it can also be said to be the characteristic of each input. It indicates the importance of a feature; B is a real number, where we can see it as a threshold.
How do you understand W and B? Let me give you an example to help you understand. The algorithm process above can be seen as a process of weighing input and making decisions. Assuming that the weekend is coming, you hear that there will be a music festival in your city. You have to decide whether to go to the festival or not. You need to make a decision by weighing 3 factors (3 features): 1, good weather 2, your girlfriend is willing to accompany you to 3, the venue is near the subway, the 3 factors are corresponding to the X1, X2, X3 (they are 3 features of the X training sample). We can give them a value, if the weather is good, then X1 is 1, or 0, X2 and X3 are the same; if you hate bad weather, if the weather is bad, you won't go to the festival, and the other two factors are not high (assuming that you are an old driver, the woman is too much, afraid to cold girlfriend). Then we assign 3 weights to 7,2,2 respectively. The value of W1 is much larger, which indicates that the weather is very important for you. It is more important than your girlfriend's willingness to go and the convenience of traffic. And B we can think of a threshold, assuming we assign B to -5, so that is to say, as long as the weather is good, even if the girlfriend doesn't accompany you, and the traffic is not convenient, you will also take part in the holiday - X1 * W1 + x2 * W2 + x3 * W3 = 1 * 7 + 0 * 2 + 0 * 2 = 7 (here we do not consider the sigma function), and 7 + (-5) > 0. The result is you will go. That music festival. If we choose different W and b values, there will be different output results for the same input X.
The purpose of training neural network is to get these W and b values through training process, which will teach you how to train them. These W and b values allow the neural network to get a judgment, a predictive power - input a picture, and the neural network, based on the trained W and B, to determine whether there is a cat in this diagram by the above formula according to the value of each pixel, the corresponding weight value and the threshold. The neural network is the way to predict it. It is the same way we think as human beings. Though we can make very complicated judgments, the basic principle is very simple. Why can people easily distinguish whether there is a cat in a picture? Because we are a giant neural network, which contains hundreds of millions or more neurons (the blue circle is a neuron), and each neuron can accept multiple inputs. In everyday life, children are constantly seeing cats through adult instruction, and our neurons have formed a lot of specific inputs for this input. W (weight), so when a cat is seen again, the input (the cat) is combined with the corresponding w to perform the operation, and the result indicates that the input is a cat.
Next, let's talk about sigma. It represents the sigmoid function. The above is its definition formula and figure. Why do we need it? In the example above, we get the result of 2. Actually, for different X and w values, the result may be bigger. So this does not apply to the two - element classification problem, because in the two - element classification problem, the y^y^ you want to get is a probability that an input is equal to the probability of its real label (such as if there is a cat in the input image). So the value of y^y^ should be between 0 and 1. The function of sigmoid function is to transform computing results to values between 0 and 1. By looking at its graphics, we can see that the greater the value Z entered into the sigmoid function, the closer the y^y^ is to 1. That is to say, the probability of having a cat inside it is bigger.
The above is why the neural network can give the general principle of prediction results. In fact, as Jack bed length said, "everyone is a huge neural network." as long as we are good at reflecting, good at summarizing, and good at learning, everyone will become more and more powerful, and can achieve better self.
Given an input feature vector x (such as the image you want to recognize - whether there is a cat), you need an algorithm to calculate the output after the calculation (in this case we use a logical regression algorithm). This is the output of the prediction we called y^y^, if y is 1, if the prediction is then y^y^ may be 0.99).
The X in the first formula in the first figure is a matrix (n, 1) dimension, which represents a training sample, and the N in it represents the number of features in a training sample. For example, a picture is a training sample, and each color intensity value is a feature; W is a matrix of (n, 1) dimension, which represents the weight (weight), which corresponds to each input feature, and it can also be said to be the characteristic of each input. It indicates the importance of a feature; B is a real number, where we can see it as a threshold.
How do you understand W and B? Let me give you an example to help you understand. The algorithm process above can be seen as a process of weighing input and making decisions. Assuming that the weekend is coming, you hear that there will be a music festival in your city. You have to decide whether to go to the festival or not. You need to make a decision by weighing 3 factors (3 features): 1, good weather 2, your girlfriend is willing to accompany you to 3, the venue is near the subway, the 3 factors are corresponding to the X1, X2, X3 (they are 3 features of the X training sample). We can give them a value, if the weather is good, then X1 is 1, or 0, X2 and X3 are the same; if you hate bad weather, if the weather is bad, you won't go to the festival, and the other two factors are not high (assuming that you are an old driver, the woman is too much, afraid to cold girlfriend). Then we assign 3 weights to 7,2,2 respectively. The value of W1 is much larger, which indicates that the weather is very important for you. It is more important than your girlfriend's willingness to go and the convenience of traffic. And B we can think of a threshold, assuming we assign B to -5, so that is to say, as long as the weather is good, even if the girlfriend doesn't accompany you, and the traffic is not convenient, you will also take part in the holiday - X1 * W1 + x2 * W2 + x3 * W3 = 1 * 7 + 0 * 2 + 0 * 2 = 7 (here we do not consider the sigma function), and 7 + (-5) > 0. The result is you will go. That music festival. If we choose different W and b values, there will be different output results for the same input X.
The purpose of training neural network is to get these W and b values through training process, which will teach you how to train them. These W and b values allow the neural network to get a judgment, a predictive power - input a picture, and the neural network, based on the trained W and B, to determine whether there is a cat in this diagram by the above formula according to the value of each pixel, the corresponding weight value and the threshold. The neural network is the way to predict it. It is the same way we think as human beings. Though we can make very complicated judgments, the basic principle is very simple. Why can people easily distinguish whether there is a cat in a picture? Because we are a giant neural network, which contains hundreds of millions or more neurons (the blue circle is a neuron), and each neuron can accept multiple inputs. In everyday life, children are constantly seeing cats through adult instruction, and our neurons have formed a lot of specific inputs for this input. W (weight), so when a cat is seen again, the input (the cat) is combined with the corresponding w to perform the operation, and the result indicates that the input is a cat.
Next, let's talk about sigma. It represents the sigmoid function. The above is its definition formula and figure. Why do we need it? In the example above, we get the result of 2. Actually, for different X and w values, the result may be bigger. So this does not apply to the two - element classification problem, because in the two - element classification problem, the y^y^ you want to get is a probability that an input is equal to the probability of its real label (such as if there is a cat in the input image). So the value of y^y^ should be between 0 and 1. The function of sigmoid function is to transform computing results to values between 0 and 1. By looking at its graphics, we can see that the greater the value Z entered into the sigmoid function, the closer the y^y^ is to 1. That is to say, the probability of having a cat inside it is bigger.
The above is why the neural network can give the general principle of prediction results. In fact, as Jack bed length said, "everyone is a huge neural network." as long as we are good at reflecting, good at summarizing, and good at learning, everyone will become more and more powerful, and can achieve better self.
PREVIOUS:Image recognition project
NEXT:Let the AI machine have a talent