Re: [R] naiveBayes other than e1071

From: Kuhn, Max <Max.Kuhn_at_pfizer.com>
Date: Mon, 04 Jun 2007 16:00:30 -0400


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_at_stat.math.ethz.ch
[mailto:r-help-bounces_at_stat.math.ethz.ch] On Behalf Of Saeed Abu Nimeh Sent: Monday, June 04, 2007 2:45 PM
To: r-help_at_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_at_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 messag...{{dropped}}
______________________________________________
R-help_at_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.
Received on Mon 04 Jun 2007 - 20:06:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Jun 2007 - 20:33:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.