Closed jsgenan closed 5 years ago
I think we should expand K by 1 if this happens. An odd number of K when having an even number of classes could avoid the tie. Or we could calculate other distance metrics such as Manhattan and cosine instead of Euclidean.
Sorry I forgot to @rickecon
@jsgenan . For equal probability, you just need an arbitrary tie break rule. An example would be if you get 0.5, choose the highest category. You could also have more sophisticated rules like choosing the class that would be chosen in K=J+1 KNN classifier. This is really just a bad example on the problem set.
In the question, if we set K=2, then observation 4 and 6 will be in the neighborhood, but they are red and green respectively. How should we handle situations like this?