is.redundant: Find Redundant Rules

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Provides the generic functions and the S4 method is.redundant to find redundant rules.

Usage

1
2
3
is.redundant(x, ...)
## S4 method for signature 'rules'
is.redundant(x, measure = "confidence")

Arguments

x

a set of rules.

measure

measure used to check for redundancy.

...

additional arguments.

Details

A rule is redundant if a more general rules with the same or a higher confidence exists. That is, a more specific rule is redundant if it is only equally or even less predictive than a more general rule. A rule is more general if it has the same RHS but one or more items removed from the LHS. Formally, a rule X -> Y is redundant if

for some X' subset X, conf(X' -> Y) >= conf(X -> Y).

This is equivalent to a negative or zero improvement as defined by Bayardo et al. (2000). In this implementation other measures than confidence, e.g. improvement of lift, can be used as well.

Value

returns a logical vector indicating which rules are redundant.

Author(s)

Michael Hahsler and Christian Buchta

References

Bayardo, R. , R. Agrawal, and D. Gunopulos (2000). Constraint-based rule mining in large, dense databases. Data Mining and Knowledge Discovery, 4(2/3):217–240.

See Also

interestMeasure

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data("Income")

## mine some rules with the consequent "language in home=english"
rules <- apriori(Income, parameter = list(support = 0.5), 
  appearance = list(rhs = "language in home=english", default = "lhs"))

## for better comparison we sort the rules by confidence and add Bayado's improvement
rules <- sort(rules, by = "confidence")
quality(rules)$improvement <- interestMeasure(rules, measure = "improvement")
inspect(rules)
is.redundant(rules)

## redundant rules
inspect(rules[is.redundant(rules)])

## non-redundant rules
inspect(rules[!is.redundant(rules)])

Example output

Loading required package: Matrix

Attaching package: 'arules'

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

    abbreviate, write

Apriori

Parameter specification:
 confidence minval smax arem  aval originalSupport maxtime support minlen
        0.8    0.1    1 none FALSE            TRUE       5     0.5      1
 maxlen target   ext
     10  rules FALSE

Algorithmic control:
 filter tree heap memopt load sort verbose
    0.1 TRUE TRUE  FALSE TRUE    2    TRUE

Absolute minimum support count: 3438 

set item appearances ...[1 item(s)] done [0.00s].
set transactions ...[50 item(s), 6876 transaction(s)] done [0.00s].
sorting and recoding items ... [11 item(s)] done [0.00s].
creating transaction tree ... done [0.00s].
checking subsets of size 1 2 3 done [0.00s].
writing ... [12 rule(s)] done [0.00s].
creating S4 object  ... done [0.00s].
     lhs                                rhs                          support confidence      lift   improvement
[1]  {ethnic classification=white}   => {language in home=english} 0.6595404  0.9847991 1.0787763  7.191373e-02
[2]  {number in household=1,                                                                                   
      number of children=0}          => {language in home=english} 0.5213787  0.9424290 1.0323629  3.602030e-03
[3]  {number in household=1}         => {language in home=english} 0.6495055  0.9388270 1.0284171  2.594159e-02
[4]  {number of children=0}          => {language in home=english} 0.5801338  0.9328812 1.0219040  1.999580e-02
[5]  {years in bay area=10+}         => {language in home=english} 0.6013671  0.9300495 1.0188020  1.716408e-02
[6]  {sex=female}                    => {language in home=english} 0.5122164  0.9246521 1.0128896  1.176674e-02
[7]  {type of home=house}            => {language in home=english} 0.5446481  0.9129693 1.0000919  8.388479e-05
[8]  {}                              => {language in home=english} 0.9128854  0.9128854 1.0000000           Inf
[9]  {dual incomes=not married}      => {language in home=english} 0.5426120  0.9069033 0.9934470 -5.982141e-03
[10] {education=no college graduate} => {language in home=english} 0.6343805  0.8995669 0.9854106 -1.331848e-02
[11] {age=14-34}                     => {language in home=english} 0.5248691  0.8966460 0.9822109 -1.623944e-02
[12] {income=$0-$40,000}             => {language in home=english} 0.5578825  0.8962617 0.9817899 -1.662372e-02
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE
    lhs                                rhs                          support confidence      lift  improvement
[1] {dual incomes=not married}      => {language in home=english} 0.5426120  0.9069033 0.9934470 -0.005982141
[2] {education=no college graduate} => {language in home=english} 0.6343805  0.8995669 0.9854106 -0.013318477
[3] {age=14-34}                     => {language in home=english} 0.5248691  0.8966460 0.9822109 -0.016239436
[4] {income=$0-$40,000}             => {language in home=english} 0.5578825  0.8962617 0.9817899 -0.016623716
    lhs                              rhs                          support confidence     lift  improvement
[1] {ethnic classification=white} => {language in home=english} 0.6595404  0.9847991 1.078776 7.191373e-02
[2] {number in household=1,                                                                               
     number of children=0}        => {language in home=english} 0.5213787  0.9424290 1.032363 3.602030e-03
[3] {number in household=1}       => {language in home=english} 0.6495055  0.9388270 1.028417 2.594159e-02
[4] {number of children=0}        => {language in home=english} 0.5801338  0.9328812 1.021904 1.999580e-02
[5] {years in bay area=10+}       => {language in home=english} 0.6013671  0.9300495 1.018802 1.716408e-02
[6] {sex=female}                  => {language in home=english} 0.5122164  0.9246521 1.012890 1.176674e-02
[7] {type of home=house}          => {language in home=english} 0.5446481  0.9129693 1.000092 8.388479e-05
[8] {}                            => {language in home=english} 0.9128854  0.9128854 1.000000          Inf

arules documentation built on Nov. 17, 2017, 6:02 a.m.