K Nearest-Neighbor Algorithm

后端 未结 5 803
春和景丽
春和景丽 2021-01-31 04:28

Maybe I\'m rather stupid but I just can\'t find a satisfying answer: Using the KNN-algorithm, say k=5. Now I try to classify an unknown object by getting its 5 nearest neighbour

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 04:56

    If you have another distance function, you can use it to break the tie. Even a bad one can do the job, better if you have some heuristics. For instance, if you know that one of the feature considered to compute your main distance is more significant, use only this one to solve the tie.

    If it's not the case, pick at random. The run several times your program on the same test set, to check if the random choice matters.

提交回复
热议问题