The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Mining and pruning association rules

Michael Hahsler

Association rule mining can produce more rules than are practical to inspect. An effective workflow constrains the search, filters and ranks the result, and then removes rules that add no information.

trans <- transactions(list(
  T1 = c("bread", "butter", "milk"),
  T2 = c("bread", "butter"),
  T3 = c("bread", "milk"),
  T4 = c("bread", "butter", "jam"),
  T5 = c("bread", "butter", "milk"),
  T6 = c("butter", "jam"),
  T7 = c("bread", "milk", "cereal"),
  T8 = c("bread", "butter", "jam")
))

Rank and filter

Filter by criteria appropriate for the task, then rank the remaining rules. Keeping these criteria in the code makes the selection reproducible.

selected <- subset(rules, lift > 1 & confidence >= 0.7)
ranked <- sort(selected, by = "lift", decreasing = TRUE)
inspect(ranked)
#>     lhs             rhs      support confidence coverage lift     count
#> [1] {jam}        => {butter} 0.375   1          0.375    1.333333 3    
#> [2] {bread, jam} => {butter} 0.250   1          0.250    1.333333 2

Many interest measures are available in addition to support, confidence, and lift. The vignette Interest measures (vignette("interest-measures", package = "arules")) introduces the use of additional interest measures.

Remove redundant rules

A rule is redundant if a more general rule with the same consequent performs at least as well according to the selected measure. Removing redundant rules produces a more concise result.

non_redundant <- rules[!is.redundant(rules)]
inspect(sort(non_redundant, by = "lift"))
#>     lhs      rhs      support confidence coverage lift     count
#> [1] {jam} => {butter} 0.375   1.00       0.375    1.333333 3    
#> [2] {}    => {butter} 0.750   0.75       1.000    1.000000 6

The complementary subset contains the redundant rules that were removed.

inspect(rules[is.redundant(rules)])
#>     lhs             rhs      support confidence coverage lift     count
#> [1] {bread}      => {butter} 0.625   0.7142857  0.875    0.952381 5    
#> [2] {bread, jam} => {butter} 0.250   1.0000000  0.250    1.333333 2

Other vignettes

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.