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

The k-NN algorithm

Mathematically speaking, the k-NN algorithm is one of the most simple machine learning algorithms out there. See the following diagram for a visual overview of how it works: 

How k-NN works under the hood

The stars in the preceding diagram represent new data points. If we built a k-NN algorithm with three neighbors, then the stars would search for the three data points that are closest to it. 

In the lower-left case, the star sees two triangles and one circle. Therefore, the algorithm would classify the star as a triangle since the number of triangles was greater than the number of circles. 

In the upper-right case, the star sees two circles and one circle. Therefore, the algorithm will classify the star as a circle since the number of circles was greater than the number of triangles. 

The real algorithm does this in a very probabilistic manner and picks the category/shape with the highest probability. 

主站蜘蛛池模板: 宜黄县| 凉山| 绩溪县| 会泽县| 太湖县| 都兰县| 太和县| 瑞丽市| 灵石县| 青田县| 株洲县| 洱源县| 尼勒克县| 新泰市| 安多县| 图们市| 衢州市| 陇川县| 尼玛县| 双柏县| 景洪市| 长春市| 鲜城| 哈尔滨市| 通许县| 栾川县| 海林市| 榆中县| 九龙坡区| 衡东县| 庆安县| 武陟县| 华安县| 彰武县| 明星| 南丹县| 夹江县| 洪泽县| 视频| 建湖县| 镇坪县|