coef | R Documentation |
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, ...)
object |
object of class inheriting from |
... |
not used. |
Coefficients extracted from the specialised Naive Bayes objects in form of a data frame.
Michal Majka, michalmajka@hotmail.com
bernoulli_naive_bayes
, multinomial_naive_bayes
, poisson_naive_bayes
, gaussian_naive_bayes
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.