[R] naiveBayes other than e1071
Kuhn, Max
Max.Kuhn at pfizer.com
Mon Jun 4 22:00:30 CEST 2007
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}}
More information about the R-help
mailing list