:
You might want to check out the function tune.knn() in the e1071 package.
Andy
_
From: [EMAIL PROTECTED] on behalf of Tim Smith
Sent: Tue 6/6/2006 8:29 PM
To: r-help@stat.math.ethz.ch
Subject: [R] knn - 10 fold cross validation [Broadcast]
Hi,
I was trying to get the optimal
Hi,
I was trying to get the optimal 'k' for the knn. To do this I was using the
following function :
knn.cvk - function(datmat, cl, k = 2:9) {
datmatT - (datmat)
cv.err - cl.pred - c()
for (i in k) {
newpre - as.vector(knn.cv(datmatT, cl, k = i))
cl.pred -
You might want to check out the function tune.knn() in the e1071 package.
Andy
_
From: [EMAIL PROTECTED] on behalf of Tim Smith
Sent: Tue 6/6/2006 8:29 PM
To: r-help@stat.math.ethz.ch
Subject: [R] knn - 10 fold cross validation [Broadcast]
Hi,
I was trying to get the optimal