Learn R Programming

FuzzyClass (version 0.1.7)

FuzzyGaussianNaiveBayes: Fuzzy Gaussian Naive Bayes Classifier Zadeh-based

Description

FuzzyGaussianNaiveBayes Fuzzy Gaussian Naive Bayes Classifier Zadeh-based

Usage

FuzzyGaussianNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)

Value

A vector of classifications

Arguments

train

matrix or data frame of training set cases.

cl

factor of true classifications of training set

cores

how many cores of the computer do you want to use to use for prediction (default = 2)

fuzzy

boolean variable to use the membership function

References

marcos2012onlineFuzzyClass

Examples

Run this code

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_GNB <- FuzzyGaussianNaiveBayes(
  train = Train[, -5],
  cl = Train[, 5], cores = 2
)

pred_GNB <- predict(fit_GNB, test)

head(pred_GNB)
head(Test[, 5])

Run the code above in your browser using DataLab