Ah, I see what you're after. I don't know of a built in function to search for the best number of nearest neighbors. You may have to run the code for each k separately, then compare the resulting errors.
Jean On Tue, Oct 13, 2015 at 9:13 AM, Neverstop <nevers...@hotmail.it> wrote: > I know that knn.cv(train=predictors.training, cl=classes.training, k=3, > prob=TRUE) works but by doing so I fix the tuning paramer k to be 3. Isn't > cross validation a technique to choose the optimal tuning parameter trying > a > range of different values for the tuning parameter? > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/k-nearest-neighbour-classification-tp4713523p4713531.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.