Description Usage Arguments Author(s) See Also Examples
Modified and extended copy of predict.naiveBayes from
e1071
.
1 2 3 |
object |
An object of class "nb2". |
newdata |
A dataframe with new predictors (with possibly fewer columns than the training data). Note that the column names of newdata are matched against the training data ones. |
type |
If "raw", the conditional a-posterior probabilities for each class are returned, and the class with maximal probability else. |
threshold |
Value replacing cells with probabilities within eps range. |
eps |
double for specifying an epsilon-range to apply laplace smoothing (to replace zero or close-zero probabilities by theshold.) |
... |
Currently ignored. |
David Meyer David.Meyer@R-project.org: original predict.naiveBayes
Philipp Aschersleben aschersleben@statistik.tu-dortmund.de: modifications and extensions for the NBCD package
nb2
, update.nb2
, plot.nb2
,
print.nb2
1 2 3 4 5 6 7 8 9 | mod <- nb2(iris[, 1:4], iris[, 5])
predict(mod, iris)
discParam <- list(Sepal.L = c(5, 6, 7), Sepal.W = c(2.5, 3.5))
mod2 <- nb2(iris[, 1:4], iris[, 5], discretize = "fixed", discParam = discParam)
predict(mod2, iris)
c(mean(predict(mod, iris) == iris$Species),
mean(predict(mod2, iris) == iris$Species))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.