KNN算法是文本分类中广泛应用的算法。作为一种基于实例的算法,训练样本的数量和分布位置影响KNN分类器分类性能。合理的样本剪裁以及样本赋权方法可以提高分类器的效率。提出了一种基于样本分布状况的KNN改进模型。首先基于样本位置对训练集进行删减以节约计算开销,然后针对类偏斜现象对分类器的赋权方式进行优化,改善k近邻选择时大类别、高密度训练样本的占优现象。试验结果表明,本文提出的改进KNN文本分类算法提高了KNN的分类效率。
In text categorization, the KNN algorithm is used widely, It is an example-based algorithm. The number of training samples and their position influence the algorithm' s classification performance. A reasonable method for reducing the amount of training data and an optimal weighting way can improve the efficiency of classification. This paper proposes an improved KNN model based on the sample distribution. Firstly, by calculating the distance between the samples, we remove some samples from training set. Secondly, take into account the category deflection; we bring up a better weighting method in order to overcome the defect that the bigger class, higher density of training samples dominated in KNN. The result of experiment shows that the improved KNN classification algorithm improves the efficiency of its classification.