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
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
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
3 matches
Mail list logo