arulesCBA (version 1.1.3-1)

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.2, confidence = 0.8,
    verbose=FALSE, parameter = NULL, control = NULL,
    sort.parameter = NULL, lhs.support = FALSE,
		disc.method = "mdlp")

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 containing the training data.

support, confidence

Minimum support and confidence for creating association rules.

verbose

Optional logical flag to allow verbose execution, where additional intermediary execution information is printed at runtime.

parameter, control

Optional parameter and control lists for apriori.

sort.parameter

Ordered vector of arules interest measures (as characters) which are used to sort rules in preprocessing.

lhs.support

Logical variable, which, when set to TRUE, indicates that LHS support should be used for rule mining. lhs.support rule mining is considerably slower than normal mining.

disc.method

Discretization method for factorizing numeric input (default: "mdlp"). See discretizeDF.supervised for more supervised discretization methods.

Value

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

Details

Formats the input data frame and calls a C implementation of the CBA algorithm from Liu, et al. (1998) split up into three stages to build a classifier based on a set of association rules.

Before the CBA algorithm in C is executed, association rules are generated with the Apriori algorithm from the arules package.

A default class is selected for the classifier. Note that for datasets which do not yield any strong association rules it is possible that no rules will be included in the classifier, and only a default class.

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, 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 DataCamp Workspace