Skip to main content
. 2019 Sep 4;25(6):485–495. doi: 10.5152/dir.2019.19321

Figure 5.

Figure 5

Over-simplified illustration of k-nearest neighbors. This machine learning algorithm classifies the unknown objects or instances (blue triangle) by assigning them to the similar objects of the classes (orange vs. black circles) based on the number of neighbors. For instance, considering 3-nearest neighbors, the class represented with black circles outnumbers the other class (orange circles) so that the unknown object is assigned to the class represented with black circles. On the other hand, in case of 5-nearest neighbors, it is assigned to the class with orange circles because the number of the instances in this class outnumbers the one with black circles.