[R] 10- fold cross validation for naive bayes(e1071)

"Julia Kröpfl" jkroepfl at gmx.net
Tue Sep 25 10:54:04 CEST 2007


Hallo!

I would need a code for 10-fold cross validation for the classifiers Naive Bayes and svm (e1071) package. Has there already been done something like that?

I tried to do it myself by applying the tune function first:

library(e1071)
tune.control <- tune.control(random =F, nrepeat=1, repeat.aggregate=min.,sampling=c("cross"),sampling.aggregate=mean, cross=10, best.model=T, performances=T)

model <- naiveBayes(code~., mydata, tune.control)
pred <- predict(model, mydata)
table(pred, mydata$code)
chisq.test(code, pred)


but I get the same results as without tuning it.

It would be great if someone could help me with this.

thx a lot, 
Juila
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger



More information about the R-help mailing list