K Nearest-Neighbor Algorithm

后端 未结 5 790
春和景丽
春和景丽 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 05:05

    If you have k=5, you look at the top five records, look at the most common result out of those five. It's probable that you would get two pairs which would put you in a bind and it would be tough, because then you have a 50/50 chance of each pair.

    So that makes life challenging. So how do you pick out a value for k? There are some metrics you can use to analyze the result after the fact, but no strict rule of what k must be, so I would make it easy on yourself just starting out and stick with k=3 instead of k=5 and then down the road look into some strategies that can assist you in optimizing the value of k, by looking at the actual accuracy of your predictions.

提交回复
热议问题