Simple machine learning algorithm (K Nearest Neighbor algorithm)

KNN classification algorithm (K nearest neighbor classification algorithm) is one of the most simple classification algorithm. Simply put, according to your neighbors to infer your category .
Scenario:

  • Create a classification system
  • Feature extraction
  • Predictive value (share price forecast, predicting user of a movie like degree)

Directly below illustrates the algorithm idea :
Currently on a lot of people will install a mobile phone APP, called vibrato. So every time you brush vibrato, and have not found your brush to (vibrato recommended) most of the video are basically you like to watch, then this is why? Perhaps here you will find a little bit of an answer. Suppose you create a video recommendation system, we will all users on a chart:
Here Insert Picture Description
the user's location in the icon depends on the preferences of each person, so people with similar preferences from the closer. Let's say Bob is brush vibrato, then you can find out from Xiaohua recent four people, according to the four men we thumbs record on speculation Xiaofang, Xiao Li, Xiao Zhao, Xiaoying like Xiaohua may also like . With so after this chart, our video recommendation system becomes very simple, as long as Xiaofang like to recommend to Xiaohua. Then we think of another question, how do we determine how similar two user do? Then use the feature extraction.
How to determine the feature extraction similarity?
Suppose there are three fruit, we have to guess what they were most like fruit, we can extract features based on size and color. Here we extracted feature is the size and color .
! [Insert Picture description here] (https://img-blog.csdnimg.cn/20200328092103391.png
Above we will feature different fruits have carried the labeling process, the following features to start drawing figure:
Here Insert Picture Description
From the Top: A fruit and fruit B looks like, because Talia looked at recently in the icon. Here we need to calculate how similar Talia in the end, is actually very simple. In high school we learned a formula, the formula is to calculate the distance between two points in a coordinate system, we take a Recall:
Here Insert Picture Description
surprise no surprises, meaning not unexpected, is that simple.
After passing through calculation, we found that A and B do like, therefore, if there are a plurality of comparison, we can compare each object is converted into a coordinate of (1,2) (2,1) (3, 3) and other three-dimensional thinking, multidimensional are the same token, this formula are invincible, remember the name of the equation "Bi Dage Tesla formula . "
Summarize
KNN is the simplest machine learning algorithms, though simple but very useful, it would appear that this algorithm is not difficult, we hope that through this article to have a preliminary understanding.

Reference books: "graphic algorithm"

Published 13 original articles · won praise 8 · views 494

Guess you like

Origin blog.csdn.net/weixin_42462651/article/details/105125789