NBTrainer: Naive Bayes Trainer

Description Usage Format Usage Methods Arguments Examples

Description

Trains a naive bayes model. It is built on top high performance naivebayes R package.

Usage

1

Format

R6Class object.

Usage

For usage details see Methods, Arguments and Examples sections.

1
2
3
nbt = NBTrainer$new(prior=NULL, laplace=0, usekernel=FALSE)
nbt$fit(X_train, "target")
prediction <- bst$predict(X_test)

Methods

$new()

Initialises an instance of naive bayes model

$fit()

fits model to an input train data and trains the model.

$predict()

returns predictions by fitting the trained model on test data.

Arguments

prior

for detailed explanation of parameters, check: https://cran.r-project.org/package=naivebayes

prior

numeric vector with prior probabilities. vector with prior probabilities of the classes. If unspecified, the class proportions for the training set are used. If present, the probabilities should be specified in the order of the factor levels.

laplace

value used for Laplace smoothing. Defaults to 0 (no Laplace smoothing)

usekernel

if TRUE, density is used to estimate the densities of metric predictors

Examples

1
2
3
4
data(iris)
nb <- NBTrainer$new()
nb$fit(iris, 'Species')
y <- nb$predict(iris)

ssi-ashraf/superml documentation built on Nov. 5, 2019, 9:18 a.m.