Learn R Programming

daltoolboxdp (version 1.2.737)

skcla_nb: Gaussian Naive Bayes Classifier

Description

Implements classification using Gaussian Naive Bayes. Wraps scikit-learn's GaussianNB through reticulate.

Usage

skcla_nb(attribute, slevels, var_smoothing = 1e-09, priors = NULL)

Value

A skcla_nb classifier object.

Arguments

attribute

Target attribute name for model building

slevels

List of possible values for classification target

var_smoothing

Portion of the largest variance of all features that is added to variances

priors

Prior probabilities of the classes. If specified must be a list of length n_classes

Details

Naive Bayes Classifier

References

Murphy, K. P. (2012). Machine Learning: A Probabilistic Perspective. (Gaussian Naive Bayes)

Examples

Run this code
if (FALSE) {
data(iris)

# Gaussian Naive Bayes for multi-class iris
clf <- skcla_nb(attribute = 'Species', slevels = levels(iris$Species))
clf <- daltoolbox::fit(clf, iris)
pred <- predict(clf, iris)
table(pred, iris$Species)
}

# More examples:
# https://github.com/cefet-rj-dal/daltoolboxdp/blob/main/examples/skcla_nb.md

Run the code above in your browser using DataLab