K nearest neigbour

In a KNN algorithm, can we put the value of k as an even number why

Hey @kkrkunalrai

Let’s think for a while: The k, in the KNN algorithm, represents the number of closest neighbors that you are comparing, right? So, no matter if you have 2 or n classes, if you choose an even k, there is a risk of a tie in the decision of which class you should set a new instance. This is why the k is usually odd - no ties.

1 Like