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

  • Machine Learning for OpenCV
  • Michael Beyeler
  • 174字
  • 2021-07-02 19:47:22

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.

主站蜘蛛池模板: 长武县| 礼泉县| 利川市| 南郑县| 西华县| 阿克陶县| 格尔木市| 苍梧县| 上高县| 五峰| 诏安县| 定襄县| 西乡县| 舞钢市| 区。| 阿鲁科尔沁旗| 吐鲁番市| 衡山县| 两当县| 黑龙江省| 龙里县| 体育| 葫芦岛市| 福泉市| 阿坝县| 安远县| 佛冈县| 华容县| 民权县| 凌海市| 曲周县| 顺义区| 旬阳县| 浦县| 西林县| 电白县| 宣恩县| 三明市| 长海县| 张掖市| 鸡东县|