Re: [R] Question about knn

2008-08-11 Thread Prof Brian Ripley
Try reading the help page (and crediting the authors of package class). Description: k-nearest neighbour classification for test set from training set. For each row of the test set, the 'k' nearest (in Euclidean distance) training set vectors are found, and the classification

[R] Question about knn

2008-08-11 Thread rami batal
Hello all, am a newby in R, am trying the knn function, and am doing just a stupid test : knn(c(1,2,3,4,5,6), c(3), k=4 ,prob=TRUE,factor(c(1:6))) the result is unstable !! i have each time different result : [1] 5 attr(,"prob") [1] 0.167 Levels: 1 2 3 4 5 6 [1] 4 attr(,"prob") [1] 0.166

[R] question about knn

2008-08-11 Thread Rami . Albatal
Hello all, am a newby in R, am trying the knn function, and am doing just a stupid test : knn(c(1,2,3,4,5,6), c(3), k=4 ,prob=TRUE,factor(c(1:6))) the result is unstable !! i have each time different result : [1] 5 attr(,"prob") [1] 0.167 Levels: 1 2 3 4 5 6 [1] 4 attr(,"prob") [1] 0.1