Re: [R] knn - 10 fold cross validation

2006-06-07 Thread Prof Brian Ripley
: 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

[R] knn - 10 fold cross validation

2006-06-06 Thread Tim Smith
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 -

Re: [R] knn - 10 fold cross validation

2006-06-06 Thread Liaw, Andy
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