# Naive Bayes
library(plyr)
library(reshape2)
class_prob 40",">40",">40","31-40","40","40"),
income = c("high","high","high","medium","low","low","low","medium","low","medium","high","medium","high","medium"),
student = c("no","no","no","no","yes","yes","yes","no","yes","yes","yes","no","yes","no"),
credit_rating = c("fair","excellent","fair","fair","fair","excellent","excellent","fair","fair","fair","excellent","excellent","fair","excellent"),
buys_computer = c("no","no", "yes", "yes", "yes","no", "yes","no", "yes", "yes", "yes", "yes", "yes","no")
)
oneObs <- data.frame(
feature.name = c("age","income","student","credit_rating"),
feature.value = c("31-40","medium","no","fair")
)
pc <- class_prob(train.computer,"buys_computer")
pfc <- feature_class_prob(train.computer,"buys_computer")
pre_class(oneObs, pc,pfc)