Learn R Programming

⚠️There's a newer version (1.2.7) of this package.Take me there.

Classification Based on Association Rules

The R package arulesCBA (Hahsler et al, 2020) is an extension of the package arules to perform association rule-based classification. The package implements the following algorithms:

  • CBA (Liu et al, 1998)
  • bCBA, wCBA (Ian Johnson, unpublished)
  • CMAR via LUCS-KDD Software Library (Li, Han and Pei, 2001)
  • CPAR via LUCS-KDD Software Library (Yin and Han, 2003)
  • C4.5 via J48 in R/Weka (Quinlan, 1993)
  • FOIL (Yin and Han, 2003)
  • PART via R/Weka (Frank and Witten, 1998)
  • PRM via LUCS-KDD Software Library (Yin and Han, 2003)
  • RCAR (Azmi et al, 2019)
  • RIPPER via R/Weka (Cohen, 1995)

The package also provides the infrastructure for associative classification (supervised discetization, mining class association rules (CARs)), and implements various association rule-based classification strategies (first match, majority voting, weighted voting, etc.).

Installation

Stable CRAN version: install from within R with

install.packages("arulesCBA")

Current development version:

library("devtools")
install_github("ianjjohnson/arulesCBA")

Usage

library("arulesCBA")
data("iris")
 
# learn a classifier
classifier <- CBA(Species ~ ., data = iris)
classifier

    CBA Classifier Object
    Class: Species=setosa, Species=versicolor, Species=virginica
    Default Class: Species=versicolor
    Number of rules: 6
    Classification method: first  
    Description: CBA algorithm (Liu et al., 1998)

# inspect the rulebase
inspect(rules(classifier), linebreak = TRUE)
     lhs                           rhs                  support conf lift count 
 [1] {Petal.Length=[-Inf,2.45)} => {Species=setosa}        0.33 1.00  3.0    50 
 [2] {Sepal.Length=[6.15, Inf],       
      Petal.Width=[1.75, Inf]}  => {Species=virginica}     0.25 1.00  3.0    37 
 [3] {Sepal.Length=[5.55,6.15),   
      Petal.Length=[2.45,4.75)} => {Species=versicolor}    0.14 1.00  3.0    21 
 [4] {Sepal.Width=[-Inf,2.95),
      Petal.Width=[1.75, Inf]}  => {Species=virginica}     0.11 1.00  3.0    17
 [5] {Petal.Width=[1.75, Inf]}  => {Species=virginica}     0.30 0.98  2.9    45 
 [6] {}                         => {Species=versicolor}    0.33 0.33  1.0   150

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

   [1] setosa setosa setosa setosa setosa setosa
   Levels: setosa versicolor virginica

References

  • M. Hahsler, I. Johnson, T. Kliegr and J. Kuchar (2019). Associative Classification in R: arc, arulesCBA, and rCBA. The R Journal 11(2), pp. 254-267.
  • M. Azmi, G.C. Runger, and A. Berrado (2019). Interpretable regularized class association rules algorithm for classification in a categorical data space. Information Sciences, Volume 483, May 2019, pp. 313-331.
  • W. W. Cohen (1995). Fast effective rule induction. In A. Prieditis and S. Russell (eds.), Proceedings of the 12th International Conference on Machine Learning, pp. 115-123. Morgan Kaufmann. ISBN 1-55860-377-8.
  • E. Frank and I. H. Witten (1998). Generating accurate rule sets without global optimization. In J. Shavlik (ed.), Machine Learning: Proceedings of the Fifteenth International Conference, Morgan Kaufmann Publishers: San Francisco, CA.
  • W. Li, J. Han and J. Pei (2001). CMAR: accurate and efficient classification based on multiple class-association rules, Proceedings 2001 IEEE International Conference on Data Mining, San Jose, CA, USA, pp. 369-376.
  • B. Liu, W. Hsu and Y. Ma (1998). Integrating Classification and Association Rule Mining. KDD'98 Proceedings of the Fourth International Conference on Knowledge Discovery and Data Mining, New York, AAAI, pp. 80-86.
  • R. Quinlan (1993). C4.5: Programs for Machine Learning. Morgan Kaufmann Publishers, San Mateo, CA.
  • X. Yin and J. Han (2003). CPAR: Classification based on Predictive Association Rules, Proceedings of the 2003 SIAM International Conference on Data Minin, pp. 331-235.

Copy Link

Version

Install

install.packages('arulesCBA')

Monthly Downloads

1,627

Version

1.2.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Michael Hahsler

Last Published

April 20th, 2020

Functions in arulesCBA (1.2.0)

classFrequency

Extracting the Response and Class Frequency for Transactions or CAR Sets
FOIL

Use FOIL to learn a rule set for classification
RCAR

Regularized Class Association Rules for Multi-class Problems (RCAR+)
bCBA

Classification Based on Association Rules
CBA

Classification Based on Association Rules Algorithm (CBA)
LUCS_KDD_CBA

Interface to the LUCS-KDD Implementations of CMAR, PRM and CPAR
Lymphography

The Lymphography Domain Data Set (UCI)
RWeka_CBA

CBA classifiers based on rule-based classifiers in RWeka
CBA.object

Objects for Classifiers Based on Association Rules
Mushroom

The Mushroom Data Set (UCI)
discretizeDF.supervised

Supervised Methods to Convert Continuous Variables into Categorical Variables
mineCARs

Mine Class Association Rules
prepareTransactions

Helper to Convert Data into Transactions
wCBA

Classification Based on Association Rules