In the context of this lesson, what if there are multiple neighbors at the same distance from a point?
This will depend on the implementation of the K-Nearest Neighbors classifier you are using.
In our implementation of this algorithm, we will select the neighbors that come earlier in the list of all neighbors. What happens is that we calculate all the neighbor distances, store them in a list, then sort the list by the distance from smallest to largest away from a point. In the case of ties, it will select whichever neighbors happened to be sorted earlier in the list.
For instance, if our list of neighbors was
[a, b, c, a, ...]
it will choose the neighbors that came first, starting from
b, and so on based on the order they were sorted in the list.
Another method to address multiple neighbors at the same distance is to select them at random. It will take all the points that are tied for their distance, and then randomly select the points from those.
There are also a few other methods available, and while this will not go into much detail, each method has its pros and cons. Whichever way you might choose, it should generally come out to a similar result.