Re: [R] naiveBayes other than e1071 Saeed Abu Nimeh wrote: > Max, > Thanks. I have tried it but i keep getting an error: > Error in as.vector(x, mode) : invalid argument 'mode' > Do I have to do something specific when using the class column. I tried > both  y.y<-as.vector and y.y<-as.factor. >  > dread<-read.table('dataset.csv',sep=",") > x.x<-as.matrix(dread[,2:256]) > y.y<-as.vector(dread[,1]) > nb<- NaiveBayes(x=x.x,grouping=y.y) > pred.nb<-predict(nb) >  > Error in as.vector(x, mode) : invalid argument 'mode' Please tell us (according to the posting guide): Which version of R?  Which version of klaR? Example data that reproduce the error? Uwe Ligges > Thanks, > Saeed >  > Kuhn, Max wrote: >> Saeed, >> >> There is a version in the klaR package. I recently submitted a change to >> the predict function that may be related to your problem.  >> >> If: >> >>   1. the posterior probabilities (apart from the prior) are being >> approximated by the product of the p(x_i|y_j) and >> >>   2. a lot of predictors are being used >> >> then posterior probabilities may have values of absolute zero.  >> >> When the approximation is used, the approximate posterior probabilities >> are normalized by their sum (which is zero in such cases). >> >> The patch in klaR uses the product of the conditional divided by the >> marginal of x_i (per the true formula). I haven't seen the problem occur >> with this patch. >> >> HTH, >> >> Max >> >> -----Original Message----- >> From: r-help-bounces@stat.math.ethz.ch >> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Saeed Abu Nimeh >> Sent: Monday, June 04, 2007 2:45 PM >> To: r-help@stat.math.ethz.ch >> Subject: [R] naiveBayes other than e1071 >> >> Hi List, >> Is there a naiveBayes interface other than the one in e1071 package. For >> some reason on certain datasets all predicted values are NaN, but it >> predicts well on others. >> Thanks, >> Saeed >> --- >> model <- naiveBayes(x.train, y.train, laplace = 3) >> pred <- predict(model,x.test,type="raw") >> >> ______________________________________________ >> R-help@stat.math.ethz.ch 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. >> >> ---------------------------------------------------------------------- >> LEGAL NOTICE >> Unless expressly stated otherwise, this message is confidential and may be privileged.  It is intended for the addressee(s) only.  Access to this E-mail by anyone else is unauthorized.  If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful.  If you are not an addressee, please inform the sender immediately. >> >  > ______________________________________________ > R-help@stat.math.ethz.ch 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. ______________________________________________ R-help@stat.math.ethz.ch 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.