The KNN classification algorithm

Let k be the number of nearest neighbors and D be the set of training examples

  1. for each test example z = (x’,y’) do
  2. Compute d(x’,x), the distance between z and every example, (x,y) ϵ D
  3. Select Dz ⊆ D, the set of k closest training examples to z
The KNN classification algorithm
The KNN classification algorithm
KNN Classification
KNN Classification

Leave a Comment