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

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. 

主站蜘蛛池模板: 马山县| 阳泉市| 天长市| 西青区| 江都市| 重庆市| 鹤壁市| 丰都县| 文登市| 昌江| 建宁县| 定远县| 都江堰市| 桃江县| 康保县| 民勤县| 乌审旗| 公安县| 香港| 清原| 桂平市| 泽州县| 庄河市| 丹江口市| 上杭县| 汉中市| 无为县| 老河口市| 富民县| 阿克苏市| 龙江县| 濮阳市| 醴陵市| 平南县| 县级市| 遂宁市| 六枝特区| 海丰县| 黄冈市| 大名县| 合阳县|