官术网_书友最值得收藏!

Understanding the k-NN algorithm

The k-NN algorithm is arguably one of the simplest machine learning algorithms. The reason for this is that we basically only need to store the training dataset. Then, in order to make a prediction for a new data point, we only need to find the closest data point in the training dataset-its nearest neighbor.

In a nutshell, the k-NN algorithm argues that a data point probably belongs to the same class as its neighbors. Think about it: if our neighbor is a Reds fan, we're probably Reds fans, too; otherwise we would have moved away a long time ago. The same can be said for the Blues.

Of course, some neighborhoods might be a little more complicated. In this case, we would not just consider our closest neighbor (where k=1), but instead our k nearest neighbors. To stick with our example as mentioned earlier, if we were Reds fans, we probably wouldn't move into a neighborhood where the majority of people are Blues fans.

That's all there is to it.

主站蜘蛛池模板: 新巴尔虎右旗| 比如县| 乌拉特后旗| 包头市| 噶尔县| 定西市| 承德市| 太保市| 河南省| 汪清县| 平罗县| 玛曲县| 新田县| 洛川县| 永兴县| 毕节市| 五大连池市| 迁安市| 甘谷县| 曲阜市| 靖江市| 长汀县| 鲁甸县| 潜山县| 泰州市| 寻乌县| 绥滨县| 德惠市| 荥阳市| 辽源市| 抚州市| 信阳市| 无棣县| 麻栗坡县| 金沙县| 石楼县| 呼和浩特市| 乌拉特前旗| 武邑县| 黎平县| 石门县|