View source: R/FuzzyTriangNaiveBayes.R
| FuzzyTriangularNaiveBayes | R Documentation |
FuzzyTriangularNaiveBayes Fuzzy Naive Bayes Triangular Classifier
FuzzyTriangularNaiveBayes(
train,
cl,
cores = 2,
fuzzy = TRUE,
verbose = fuzzy_verbose()
)
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
kept for backward compatibility; prediction is vectorized and does not start parallel workers (default = 2) |
fuzzy |
boolean variable to use the membership function |
verbose |
logical; if |
A trained FuzzyTriangularNaiveBayesModel R6 object (which inherits from FuzzyClassifier). Use predict(object, newdata, type = "class") or object$predict(newdata) to classify new observations; type = "prob" (or "matrix") returns the matrix of class probabilities.
de2020onlineFuzzyClass
FuzzyTriangularNaiveBayesModel for the R6 interface and fuzzy_naive_bayes() (engine "triangular") for the tidymodels interface.
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_NBT <- FuzzyTriangularNaiveBayes(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 5])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.