Here we use an example. Originally, the point should be classified as a positive type, and the point should be classified as a negative type. After updating, the correctness of the algorithm is intuitively judged.
First, when our perceptron algorithm is updated to a certain point, if the original correct category of point A is positive, and y=1, the algorithm judges it as a negative category and judges it as -1, as shown below:
we can see this time It is updated to the red positive box in the lower left corner. At this time, it is classified incorrectly. Suppose it is a positive class y=1, and we classify it into a negative class and divide it into -1.
Then update the parameters! The update method is as follows:
So why must the updated hyperplane be better than the unupdated hyperplane?
Let's explain from two parts of theory and visualization
theory
Before the update, our wx+b was less than 0, which caused us to mistakenly classify into the negative category. The correct label is y=1, which is the positive category. Then after the update, we will calculate again, as follows:
where y=1, the formula has been brought in.
We can see that after the update, a positive value is added to the original wx+b, that is to say, after the update, the negative value of the original division must go positive! !
This is the theoretical conclusion that each update will be better.
Visualization
This update method also has an intuitive feeling, which can be visually understood, as shown in the following figure:
In the above figure, w is the normal vector of the learned hyperplane. It can be seen that it has classified x wrongly. Then we need to move the hyperplane to the x direction at this time to finally divide the x point.
When our data point should be classified as y=+1, we mistakenly divided it into -1 (then judge wx+b<0, then it means w x<0, which means that the angle between w and x vector is greater than 90 degrees), this time It should be adjusted. The update process is w=w+1 x, which is closer to the x vector direction, and to the direction that can be divided into x points! As shown in the figure below:
This also intuitively illustrates the correctness of the update algorithm from a visual point of view.
Acknowledgements: Teacher Zhang Yue
recommends reading:
Selected dry goods|Summary of dry goods catalog for the past six months-all hard goods are easy to understand! Welcome to read!
Dry Goods | National Taiwan University Lin Xuantian Machine Learning Foundation Stone Course Study Notes 3 - Types of Learning
Dry Goods Taiwan University Lin Xuantian Machine Learning Foundation Stone Course Study Notes 2 - Learning to Answer Yes/No
Dry Goods Taiwan University Lin Xuantian Machine Learning Foundation Stone Note 1 - The Learning Problem
欢迎关注公众号学习交流~