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 Bayesgnb <- gaussian_naive_bayes(x = M, y = y)### Extract coefficientscoef(gnb)coef(gnb)[c(TRUE,FALSE)]# only meanscoef(gnb)[c(FALSE,TRUE)]# only standard deviations