2

This was my professor's interpretation but he didn’t provide an example:

there could be training points at the same distance from x such that more than k points are closest to x. In this case, we proceed by ranking the training points based on their distance from x and then taking the k′ closest points where k′ is the smallest integer bigger or equal to k such that the (k′+ 1)-th point in the ranking has distance from x strictly larger than the k'-th point. If no such k′ exists, then we take all the points

Milo
  • 21

1 Answers1

1

In practice this is usually solved by taking arbitrary points, e.g. $k$ first points, or random $k$ points. The rationale is that it should not make that a big difference and if it does, then maybe you should pick a larger $k$ parameter. $k$NN is intended to be a simple algorithm, but can be computationally demanding with a lot of data, so adding unnecessary complexity to it is not desirable.

Tim
  • 138,066