Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predict.NaiveBayes

Naive Bayes Classifier


Description

Computes the conditional a-posterior probabilities of a categorical class variable given independent predictor variables using the Bayes rule.

Usage

## S3 method for class 'NaiveBayes'
predict(object, newdata, threshold = 0.001, ...)

Arguments

object

An object of class "naiveBayes".

newdata

A dataframe with new predictors.

threshold

Value replacing cells with 0 probabilities.

...

passed to dkernel function if neccessary.

Details

This implementation of Naive Bayes as well as this help is based on the code by David Meyer in the package e1071 but extended for kernel estimated densities. The standard naive Bayes classifier (at least this implementation) assumes independence of the predictor variables. For attributes with missing values, the corresponding table entries are omitted for prediction.

Value

A list with the conditional a-posterior probabilities for each class and the estimated class are returned.

Author(s)

Karsten Luebke, karsten.luebke@fom.de

See Also

Examples

data(iris)
m <- NaiveBayes(Species ~ ., data = iris)
predict(m)

klaR

Classification and Visualization

v0.6-15
GPL-2 | GPL-3
Authors
Christian Roever, Nils Raabe, Karsten Luebke, Uwe Ligges, Gero Szepannek, Marc Zentgraf, David Meyer
Initial release
2020-02-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.