# NOT RUN {
feat1 <- mmb::createFeatureForBayes(
name = "Petal.Length", value = mean(iris$Petal.Length))
feat2 <- mmb::createFeatureForBayes(
name = "Petal.Width", value = mean(iris$Petal.Width))
featT <- mmb::createFeatureForBayes(
name = "Species", iris[1,]$Species, isLabel = TRUE)
# Check the probability of Species=setosa, given the other 2 features:
mmb::bayesProbabilityNaive(
df = iris, features = rbind(feat1, feat2, featT), targetCol = "Species")
# Now check the probability of Species=versicolor:
featT$valueChar <- "versicolor"
mmb::bayesProbabilityNaive(
df = iris, features = rbind(feat1, feat2, featT), targetCol = "Species")
# }
Run the code above in your browser using DataLab