search for: neibhour

Displaying 1 result from an estimated 1 matches for "neibhour".

Did you mean: neigbhour
2011 Sep 08
1
error in knn: too many ties in knn
...y example. > library(class) > train <- matrix(nrow=5000,ncol=2,data=rnorm(10000,0,1)) > test <- matrix(nrow=10,ncol=2,data=rnorm(20,0,1)) > cl <- rep(c(0,1),2500) > knn(train,test,cl,1) [1] 1 1 0 0 1 0 1 1 0 1 Levels: 0 1 It works properly if you pass any number of nearest neibhours (4-th parameter) from 1 to 499 But if you run it with number of n.n. >= 500 than there would be an error. > knn(train,test,cl,500) error in knn(train, test, cl, 500) : too many ties in knn no matter what data you have. even if you run it with odd number of n.n., say, 501 (so there just can&...