rules: Get the Association Rules from a CBA classifier

Description Usage Arguments Details Author(s) Examples

View source: R/rules.R

Description

Returns the association rules used in the model from a CBA classifier object.

Usage

1
rules(classifier)

Arguments

classifier

An object of class CBA.

...

Additional arguments not used

Details

Returns an arules rule set (object of class rules) of all of the association rules used in the classifier.

Author(s)

Ian Johnson

Examples

1
2
3
4
5
6
7
8
data(iris)
irisDisc <- as.data.frame(lapply(iris[1:4],
  function(x) discretize(x, categories=9)))
irisDisc$Species <- iris$Species

classifier <- CBA(Species ~ ., irisDisc, supp = 0.05, conf=0.9)
rules <- rules(classifier)
inspect(rules)

Example output

Loading required package: Matrix
Loading required package: arules

Attaching package: 'arules'

The following objects are masked from 'package:base':

    abbreviate, write

     lhs                            rhs                     support confidence     lift count
[1]  {Petal.Length=[1.00,1.66)}  => {Species=setosa}     0.29333333  1.0000000 3.000000    44
[2]  {Petal.Width=[0.100,0.367)} => {Species=setosa}     0.27333333  1.0000000 3.000000    41
[3]  {Petal.Length=[5.59,6.24)}  => {Species=virginica}  0.12666667  1.0000000 3.000000    19
[4]  {Petal.Length=[3.62,4.28)}  => {Species=versicolor} 0.11333333  1.0000000 3.000000    17
[5]  {Petal.Width=[1.967,2.233)} => {Species=virginica}  0.10000000  1.0000000 3.000000    15
[6]  {Petal.Width=[2.233,2.500]} => {Species=virginica}  0.09333333  1.0000000 3.000000    14
[7]  {Petal.Length=[4.28,4.93),                                                              
      Petal.Width=[1.167,1.433)} => {Species=versicolor} 0.08666667  1.0000000 3.000000    13
[8]  {Petal.Width=[0.900,1.167)} => {Species=versicolor} 0.06666667  1.0000000 3.000000    10
[9]  {Sepal.Width=[2.80,3.07),                                                               
      Petal.Width=[1.167,1.433)} => {Species=versicolor} 0.06666667  1.0000000 3.000000    10
[10] {Petal.Width=[0.367,0.633)} => {Species=setosa}     0.06000000  1.0000000 3.000000     9
[11] {Petal.Width=[1.700,1.967)} => {Species=virginica}  0.10666667  0.9411765 2.823529    16

arulesCBA documentation built on July 27, 2017, 9:01 a.m.