Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ianstenbit/arulescba

Classification Based on Association Rules in R
https://github.com/ianstenbit/arulescba

algorithm association-rules cba classification cran r

Last synced: 16 days ago
JSON representation

Classification Based on Association Rules in R

Awesome Lists containing this project

README

        

---
title: "R package arulesCBA: Classification Based on Association Rules"
output: github_document
---

```{r echo=FALSE}
options(digits = 2)
knitr::opts_chunk$set(tidy = TRUE, message = FALSE)
```

```{r echo=FALSE, results = 'asis'}
pkg <- 'arulesCBA'

library(stringr)

cat(str_interp("[![CRAN version](http://www.r-pkg.org/badges/version/${pkg})](https://CRAN.R-project.org/package=${pkg})\n"))
cat(str_interp("[![stream r-universe status](https://mhahsler.r-universe.dev/badges/${pkg})](https://mhahsler.r-universe.dev/ui#package:${pkg})\n"))
cat(str_interp("[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/grand-total/${pkg})](https://CRAN.R-project.org/package=${pkg})\n"))
```

The R package [arulesCBA](https://cran.r-project.org/package=arulesCBA) (Hahsler et al, 2020)
is an extension of the package [arules](https://cran.r-project.org/package=arules) to perform
association rule-based classification. The package provides the infrastructure for class association rules and implements associative classifiers based on the following algorithms:

* __CBA__: Classification Based on Association Rules (Liu et al, 1998).
* __CMAR__: Classification based on Multiple Association Rule (Li, Han and Pei, 2001) via LUCS-KDD Software Library.
* __CPAR__: Classification based on Predictive Association Rules (Yin and Han, 2003) via LUCS-KDD Software Library.
* __C4.5__: Rules extracted from a C4.5 decision tree (Quinlan, 1993) via J48 in R/Weka.
* __FOIL__: First-Order Inductive Learner (Yin and Han, 2003).
* __PART__: Rules from Partial Decision Trees (Frank and Witten, 1998) via R/Weka.
* __PRM__: Predictive Rule Mining (Yin and Han, 2003) via LUCS-KDD Software Library.
* __RCAR__: Regularized Class Association Rules using Logistic Regression (Azmi et al, 2019).
* __RIPPER__: Repeated Incremental Pruning to Produce Error Reduction (Cohen, 1995) via R/Weka.

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
```{r eval=FALSE}
install.packages("arulesCBA")
```

__Current development version:__ Install from [r-universe.](https://mhahsler.r-universe.dev/ui#package:arulesCBA)

## Usage

```{r}
library("arulesCBA")
data("iris")
```

Learn a classifier.

```{r}
classifier <- CBA(Species ~ ., data = iris)
classifier
```

Inspect the rulebase.

```{r}
inspect(rules(classifier), linebreak = TRUE)
```

Make predictions for the first few instances of iris.

```{r}
predict(classifier, head(iris))
```

## References

* M. Hahsler, I. Johnson, T. Kliegr and J. Kuchar (2019). [Associative Classification in R: arc, arulesCBA, and rCBA](https://journal.r-project.org/archive/2019/RJ-2019-048/). _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.