multinomial_naive_bayes is used to fit the Multinomial Naive Bayes model.
multinomial_naive_bayes(x, y, prior =NULL, laplace =0.5,...)
Arguments
x: numeric matrix with integer predictors (matrix or dgCMatrix from Matrix package).
y: class vector (character/factor/logical).
prior: 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 (additive smoothing). Defaults to 0.5.
...: not used.
Returns
multinomial_naive_bayes returns an object of class "multinomial_naive_bayes" which is a list with following components: - data: list with two components: x (matrix with predictors) and y (class variable).
levels: character vector with values of the class variable.
laplace: amount of Laplace smoothing (additive smoothing).
params: matrix with class conditional parameter estimates.
prior: numeric vector with prior probabilities.
call: the call that produced this object.
Details
This is a specialized version of the Naive Bayes classifier, where the features represent frequencies generated by a multinomial distribution.
Sparse matrices of class "dgCMatrix" (Matrix package) are supported in order to speed up calculation times.
Please note that the Multinomial Naive Bayes is not available through the naive_bayes function.