Learn R Programming

arulesCBA (version 1.1.6)

CBA: Classification Based on Association Rules Algorithm (CBA)

Description

Build a classifier based on association rules mined for an input dataset. The CBA algorithm used is a modified version of the algorithm described by Liu, et al. (1998).

Usage

CBA(formula, data, support = 0.1, confidence = 0.8, pruning = "M1",
    disc.method = "mdlp", balanceSupport = FALSE,
    parameter = NULL, control = NULL, ...)

pruneCBA_M1(formula, rules, trans, verbose = FALSE) pruneCBA_M2(formula, rules, trans)

Arguments

formula

A symbolic description of the model to be fitted. Has to be of form class ~ . or class ~ predictor1 + predictor2.

data

A data.frame or a transaction set containing the training data. Data frames are automatically discretized and converted to transactions.

support, confidence

Minimum support and confidence for creating association rules.

disc.method

Discretization method used to discretize continuous variables if data is a data.frame (default: "mdlp"). See discretizeDF.supervised for more supervised discretization methods.

balanceSupport

balanceSupport parameter passed to mineCARs function.

pruning

Pruning strategy used: "M1" or "M2".

parameter, control

Optional parameter and control lists for apriori.

...

For convenience, additional parameters are used to create the parameter control list for apriori (e.g., to specify the support and confidence thresholds).

rules, trans

prune a set of rules using a transaction set.

verbose

Show progress?

Value

Returns an object of class CBA.object representing the trained classifier.

Details

Implementation the CBA algorithm with the M1 or M2 pruning strategy introduced by Liu, et al. (1998).

The data is converted into a transaction set from package arules. Then candidate CARs are created using mineCARs() and pruneCBA_M2() selects the rules included into the classifier's rule base.

References

Liu, B. Hsu, W. and Ma, Y (1998). Integrating Classification and Association Rule Mining. KDD'98 Proceedings of the Fourth International Conference on Knowledge Discovery and Data Mining, New York, 27-31 August. AAAI. pp. 80-86.

See Also

CBA.object, discretizeDF.supervised, mineCARs, apriori, rules, transactions.

Examples

Run this code
# NOT RUN {
data("iris")

# learn a classifier using automatic default discretization
classifier <- CBA(Species ~ ., data = iris, supp = 0.05, conf = 0.9)
classifier

# make predictions for the first few instances of iris
predict(classifier, head(iris))

# inspect the rule base
inspect(rules(classifier))

# learn classifier from transactions
trans <- as(discretizeDF.supervised(Species ~ ., iris), "transactions")
classifier <- CBA(Species ~ Sepal, data = trans, supp = 0.05, conf = 0.9)
classifier
predict(classifier, head(trans))
# }

Run the code above in your browser using DataLab