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.1666667
Levels: 1 2 3 4 5 6

[1] 4
attr(,"prob")
[1] 0.1666667
Levels: 1 2 3 4 5 6

[1] 1
attr(,"prob")
[1] 0.1666667
Levels: 1 2 3 4 5 6

ect...

I would like to know why ?

the thing that am searching for is to have the 4 NN and sort them according
to there
distance to the test point.

Tank you

-- 
Rami

	[[alternative HTML version deleted]]

