KNN算法是经典的文本分类算法.训练样本的数量和类别密度是影响算法性能的主要瓶颈,合理的样本剪裁可以提高分类器效率.文中提出了一种基于聚类的改进KNN分类模型.首先对训练集进行聚类,基于测试样本与簇之间的相对位置对训练集进行合理裁剪以节约计算开销;然后基于簇内样本分布进行样本赋权,改善大类别样本的密度占优现象.实验结果表明,本文提出的样本剪裁方法提高了KNN算法的分类性能.
KNN is one of the classical algorithms in text categorization. The number of training samples and the density is the primary bottleneck on the algorithm. A reasonable method for reducing the amount of training data can improve the efficiency of classification. This paper proposes an improved KNN model basing on clustering. Firstly, by clustering the samples into clusters, we remove some samples from training set basing on the distance in order to save computing cost. Secondly, take into account the category distribution we bring up a better weighting method in order to overcome the defect that the bigger class of training samples dominated in KNN. The result of test shows that the improved KNN classification algorithm improves the efficiency of its classification.