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

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.

主站蜘蛛池模板: 闽侯县| 盘锦市| 陕西省| 九寨沟县| 乌拉特前旗| 太原市| 通渭县| 鹤庆县| 垫江县| 吉水县| 河西区| 称多县| 洛浦县| 濮阳县| 谷城县| 灌云县| 宁强县| 托里县| 亳州市| 鄂温| 崇阳县| 曲水县| 颍上县| 江口县| 临猗县| 高安市| 浏阳市| 香河县| 上饶县| 河东区| 旌德县| 禹州市| 江城| 荥阳市| 吴旗县| 北京市| 高碑店市| 南乐县| 鄄城县| 五河县| 长岛县|