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])
Run the code above in your browser using DataLab