kNN

How it works

Is an instance-based algorithm. So, there is not training step. Classification is directly inferred!

For every unlabeled instance (the ones to be classified):

  1. It measures the distance to every labeled sample.

  2. It sorts the distances incrementally.

  3. It selects the closets k instances.

  4. It assigns the most frequent class on the selected k instances.

Last updated