Description Usage Arguments Value Examples
Loads and saves fitted Naive Bayes models.
1 2 3 4 5 6 7 8 9 |
model |
the fitted Naive Bayes model to save. |
filename |
the file name to use to save or load the model. |
overwrite |
Whether to allow overwriting of previously saved models. |
fnb.save returns the filename that was used, and fnb.load returns the saved object.
1 2 3 4 5 6 7 8 9 10 11 | rm(list = ls())
library(fastNaiveBayes)
cars <- mtcars
y <- as.factor(ifelse(cars$mpg > 25, "High", "Low"))
x <- cars[,2:ncol(cars)]
mod <- fastNaiveBayes(x, y, laplace = 1)
fnb.save(mod, "fastNaiveBayesModel")
mod2 <- fnb.load("fastNaiveBayesModel")
identical(mod, mod2)
file.remove("fastNaiveBayesModel")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.