Hey guys,

I can't get my Naive Bayes model to predict.  Forgive me if its simple...
I've tried about everything and can't get it to work.  Reproduceable code
below.

Thank you,

Mike
-- 
Michael Schumacher
Manager Data & Analytics - ValueClick
[email protected]


*
Functional Example Code from UCLA:
http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/e1071/html/predict.naiveBayes.html
*

install.packages('e1071')
install.packages('mlbench')
library(e1071)
library(mlbench)

data(HouseVotes84)
model <- naiveBayes(Class ~ ., data = HouseVotes84)
predict(model, HouseVotes84[1:10,-1])


*My Code That Errors:*
resp<-c(0,0,0,0,0,0,0,0,0,1,1,1,1,1,1)
var <-c('y','n','y','y','y','n','y','y','y','n','n','n','n','n','y')
temp<-data.frame(resp,var)
print(temp)

model<-naiveBayes(resp~.,data=temp)
model
predict(model,temp[,-1])

#Error:
#Error in log(sapply(attribs, function(v) { :
#Non-numeric argument to mathematical function

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
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.

Reply via email to