details_naive_Bayes_klaR | R Documentation |
klaR::NaiveBayes()
fits a model that uses Bayes' theorem to compute the
probability of each class, given the predictor values.
For this engine, there is a single mode: classification
This model has 2 tuning parameter:
smoothness
: Kernel Smoothness (type: double, default: 1.0)
Laplace
: Laplace Correction (type: double, default: 0.0)
Note that the engine argument usekernel
is set to TRUE
by default
when using the klaR
engine.
The discrim extension package is required to fit this model.
library(discrim) naive_Bayes(smoothness = numeric(0), Laplace = numeric(0)) %>% set_engine("klaR") %>% translate()
## Naive Bayes Model Specification (classification) ## ## Main Arguments: ## smoothness = numeric(0) ## Laplace = numeric(0) ## ## Computational engine: klaR ## ## Model fit template: ## discrim::klar_bayes_wrapper(x = missing_arg(), y = missing_arg(), ## adjust = numeric(0), fL = numeric(0), usekernel = TRUE)
The columns for qualitative predictors should always be represented as factors (as opposed to dummy/indicator variables). When the predictors are factors, the underlying code treats them as multinomial data and appropriately computes their conditional distributions.
Variance calculations are used in these computations so zero-variance predictors (i.e., with a single unique value) should be eliminated before fitting the model.
The underlying model implementation does not allow for case weights.
Kuhn, M, and K Johnson. 2013. Applied Predictive Modeling. Springer.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.