knn.cv(train, cl, k=1, l=0, prob=F, use.all=T)
doubt. (More
precisely, less than
k-l dissenting votes are allowed, even if
k
is increased by ties.)
prob.
kth
largest are included. If false, a random selection of distances
equal to the
kth is chosen to use exactly
k neighbours.
This uses leave-one-out cross validation.
For each row of the training set
train, the
k nearest
(in Euclidean distance) other
training set vectors are found, and the classification is decided by
majority vote, with ties broken at random. If there are ties for the
k
th nearest vector, all candidates are included in the vote.
doubt will be returned as
NA.
train <- rbind(iris[,,1],iris[,,2],iris[,,3])
cl <- factor(c(rep("s",50),rep("c",50), rep("v",50)))
knn.cv(train, cl, k=3, prob=T)
attributes(.Last.value)