K-nearest neighbors algorithm: Difference between revisions

Content deleted Content added
No edit summary
Tag: extraneous markup
Line 16:
 
==Algorithm==
[[Image:KnnClassification.svg|thumb|right|'''Example of ''k''-NN classification.''''''''Italic text''''' The test sample (green circle) should be classified either to the first class of blue squares or to the second class of red triangles. If ''k = 3'' (solid line circle) it is assigned to the second class because there are 2 triangles and only 1 square inside the inner circle. If ''k = 5'' (dashed line circle) it is assigned to the first class (3 squares vs. 2 triangles inside the outer circle).]]
 
The training examples are vectors in a multidimensional feature space, each with a class label. The training phase of the algorithm consists only of storing the [[feature vector]]s and class labels of the training samples.