coef function

Extract Model Coefficients

Extract Model Coefficients

coef is a generic function which extracts model coefficients from specialized Naive Bayes objects.

## S3 method for class 'bernoulli_naive_bayes' coef(object, ...) ## S3 method for class 'multinomial_naive_bayes' coef(object, ...) ## S3 method for class 'poisson_naive_bayes' coef(object, ...) ## S3 method for class 'gaussian_naive_bayes' coef(object, ...)

Arguments

  • object: object of class inheriting from "*_naive_bayes".
  • ...: not used.

Returns

Coefficients extracted from the specialised Naive Bayes objects in form of a data frame.

Examples

data(iris) y <- iris[[5]] M <- as.matrix(iris[-5]) ### Train the Gaussian Naive Bayes gnb <- gaussian_naive_bayes(x = M, y = y) ### Extract coefficients coef(gnb) coef(gnb)[c(TRUE,FALSE)] # only means coef(gnb)[c(FALSE,TRUE)] # only standard deviations

Author(s)

Michal Majka, michalmajka@hotmail.com

See Also

bernoulli_naive_bayes, multinomial_naive_bayes, poisson_naive_bayes, gaussian_naive_bayes