Hello fellow R programmers,

I'm trying to use package e1071's naiveBayes function to create a model with
weighted data.  See example below, variable "d" is a count variable that
provides the # of records for the given observation combination.  Is anyone
aware of a "weight" argument to this method?  I've been unsuccessful in my
research.

Thanks,

Mike

library(e1071)

a<-c(1,1,1,1,0,0,0,0)
b<-c("A","B","A","B","A","B","A","B")
c<-c("X","X","Y","Y","X","X","Y","Y")
d<-c(4,3,2,1,20,15,11,4)

input<-data.frame(a,b,c,d)

## NAIVE BAYES - NO WEIGHT ##

model <- naiveBayes(a ~ factor(b)+factor(c), data = input)


## NAIVE BAYES - WEIGHT by d? ##
model <-naiveBayers(a~factor(b)+factor(c),data=input,weight=d)



-- 
Michael Schumacher
mike.schumac...@gmail.com
Manager, Data & Analytics
ValueClick

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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