View source: R/DWFuzzyGammaNaiveBayes.R
DWFuzzyGammaNaiveBayes | R Documentation |
DWFuzzyGammaNaiveBayes
Double Weighted Fuzzy Gamma Naive Bayes
DWFuzzyGammaNaiveBayes(train, cl, cores = 2, fuzzy = TRUE, wdelta, weta)
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 |
wdelta |
vector weight each class |
weta |
vector weight each feature |
A vector of classifications
marcos2020doubleFuzzyClass
set.seed(1) # determining a seed
data(GamWeightData)
# Splitting into Training and Testing
split <- caTools::sample.split(t(GamWeightData[, 1]), SplitRatio = 0.7)
Train <- subset(GamWeightData, split == "TRUE")
Test <- subset(GamWeightData, 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[, -4]
fit_NBT <- DWFuzzyGammaNaiveBayes(
train = Train[, -4],
cl = Train[, 4], cores = 2,
wdelta = c(2.002/6,1.998/6,2.000/6),
weta = c(3/10,2/10, 5/10)
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 4])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.