knn1(class)
knn1()所属R语言包:class
1-nearest neighbour classification
1最近邻分类
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Nearest neighbour classification for test set from training set. For each row of the test set, the nearest (by Euclidean distance) training set vector is found, and its classification used. If there is more than one nearest, a majority vote is used with ties broken at random.
最近邻分类训练集测试。测试集的每一行(欧氏距离)最近的训练集向量被发现,并对其进行分类使用。如果有超过最靠近多数票用随机打破关系。
用法----------Usage----------
knn1(train, test, cl)
参数----------Arguments----------
参数:train
matrix or data frame of training set cases.
矩阵或数据框的训练集情况。
参数:test
matrix or data frame of test set cases. A vector will be interpreted as a row vector for a single case.
矩阵或数据框的测试集情况。行向量为一个单一的情况下将被解释为一个向量。
参数:cl
factor of true classification of training set. </table>
真正的训练集分类的因素。 </ TABLE>
值----------Value----------
Factor of classifications of test set.
测试集的分类因素。
参考文献----------References----------
Pattern Recognition and Neural Networks. Cambridge.
Modern Applied Statistics with S. Fourth edition. Springer.
参见----------See Also----------
knn
knn
举例----------Examples----------
train <- rbind(iris3[1:25,,1], iris3[1:25,,2], iris3[1:25,,3])
test <- rbind(iris3[26:50,,1], iris3[26:50,,2], iris3[26:50,,3])
cl <- factor(c(rep("s",25), rep("c",25), rep("v",25)))
knn1(train, test, cl)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|