# NOT RUN {
data("iris")
# discretize and create transactions
iris.disc <- discretizeDF.supervised(Species ~., iris)
trans <- as(iris.disc, "transactions")
# create rule base with CARs
cars <- mineCARs(Species ~ ., trans, parameter = list(support = .01, confidence = .8))
cars <- cars[!is.redundant(cars)]
cars <- sort(cars, by = "conf")
# create classifier and use the majority class as the default if no rule matches.
cl <- CBA_ruleset(Species ~ ., cars, method = "first",
default = uncoveredMajorityClass(Species ~ ., trans, cars))
cl
# look at the rule base
rules(cl)
# make predictions
prediction <- predict(cl, trans)
table(prediction, response(Species ~ ., trans))
# use weighted majority
cl <- CBA_ruleset(Species ~ ., cars, method = "majority", weights = "lift",
default = uncoveredMajorityClass(Species ~ ., trans, cars))
cl
prediction <- predict(cl, trans)
table(prediction, response(Species ~ ., trans))
# }
Run the code above in your browser using DataLab