data("iris")
iris.disc <- discretizeDF.supervised(Species ~ ., iris)
iris.trans <- as(iris.disc, "transactions")
inspect(head(iris.trans, n = 3))
# convert the class items back to a class label
response(Species ~ ., head(iris.trans, n = 3))
# Class labels
classes(Species ~ ., iris.trans)
# Class distribution. The iris dataset is perfectly balanced.
classFrequency(Species ~ ., iris.trans)
# Majority class
# (Note: since all class frequencies for iris are the same, the first one is returned)
majorityClass(Species ~ ., iris.trans)
# Use for CARs
cars <- mineCARs(Species ~ ., iris.trans, parameter = list(support = 0.3))
#' # Class labels
classes(Species ~ ., cars)
# Number of rules for each class
classFrequency(Species ~ ., cars, type = "absolute")
# conclusion (item in the RHS) of the rule as a class label
response(Species ~ ., cars)
# How many rules (using the first three rules) cover each transactions?
transactionCoverage(iris.trans, cars[1:3])
# Number of transactions per class not covered by the first three rules
uncoveredClassExamples(Species ~ ., iris.trans, cars[1:3])
# Majority class of the uncovered examples
uncoveredMajorityClass(Species ~ ., iris.trans, cars[1:3])
Run the code above in your browser using DataLab