k最近邻算法中k的值 [英] Value of k in k nearest neighbor algorithm

查看:108
本文介绍了k最近邻算法中k的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有7个类别需要分类,并且我有10个功能.在这种情况下,我是否需要使用k的最佳值?或者我必须针对1到10(大约10)之间的k值运行KNN并借助算法本身确定最佳值?

I have 7 classes that needs to be classified and I have 10 features. Is there a optimal value for k that I need to use in this case or do I have to run the KNN for values of k between 1 and 10 (around 10) and determine the best value with the help of the algorithm itself?

推荐答案

除了

In addition to the article I posted in the comments there is this one as well that suggests:

选择k非常关键– k的值越小,噪声对结果的影响越大.较大的值使其计算昂贵,并且有点违反了KNN的基本原理(附近的点可能具有相似的密度或类).选择k的简单方法是将k设置为n =(1/2).

Choice of k is very critical – A small value of k means that noise will have a higher influence on the result. A large value make it computationally expensive and kinda defeats the basic philosophy behind KNN (that points that are near might have similar densities or classes ) .A simple approach to select k is set k = n^(1/2).

这将在很大程度上取决于您的具体情况,有时最好遍历k的每个可能值并自行决定.

It's going to depend a lot on your individual cases, sometimes it is best to run through each possible value for k and decide for yourself.

这篇关于k最近邻算法中k的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆