fit: Fitting the NBC model

Description Usage Arguments Value Examples

View source: R/fit.R

Description

fit is used to fit the Naive Bayes Classifier model. It can compute with all types of variables, applying discretisation on quantitative variables and need a qualitative predictive variable.

Usage

1
fit(formula, data, laplace=1, parallel=FALSE)

Arguments

formula

an object of class formula.

data

a dataframe containing the variables in the model.

laplace

an integer that will be use to do the Laplace smoothing.

parallel

a logic that allow the user to compute the function using parallel computation.

Value

an NBAYES object containing several information that can be useful for the user and had to pass to the predict function. The informations depends if the fit had to discretize or not. For both cases the fit return:

NBAYES$table_proba_cond, a table containing he conditionnal probabilities

NBAYES$prior, a table full by the prior probabilities

Plus, if discretization occured:

NBAYES$condition, a dataframe with names of the column that was discretize and their column number

NBAYES$cuts, a list of cuts made by discretization

NBAYES$var_a_predire, the name of the variable to predict

Examples

1
2
3
data(iris)
df <- iris
model <- fit(Species ~ ., df, laplace=1, parallel=FALSE)

ldelecourt/NBC_package documentation built on Dec. 16, 2019, 10:51 p.m.