[R] NAIVE BAYES with 10-fold cross validation

"Julia Kröpfl" jkroepfl at gmx.net
Tue Oct 30 21:46:28 CET 2007


hi there!!

i am trying to implement the code of the e1071 package for naive bayes, but it doens't really work, any ideas??
i am very glad about any help!!
i need a naive bayes with 10-fold cross validation:

code:
library(e1071)

model <- naiveBayes(code ~ ., mydata)

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

pred <- predict(model, mydata[,-12], type="class")
tune(naiveBayes, code~., mydata, predict.fun=pred, tune.control)


thx for your help!
cheers, julia
--



More information about the R-help mailing list