Alternative rule plots

Market Basket Analysis in R

Christopher Bruffaerts

Statistician

Group-based matrix visualizations

Rule extraction with apriori

rules = apriori(data_trx, 
                parameter = list(
                  supp = 1/7,
                  conf = 0.6,
                  minlen = 2)
)

Method grouped

plot(rules, method = "grouped")

grouped

Market Basket Analysis in R

Group-based matrix visualizations

Grouped matrix with different metrics

plot(rules, 
     method = "grouped",
     measure = "lift",
     shading = "confidence")

grouped2

Market Basket Analysis in R

Parallel coordinate plots

Generating rules and calling the plot

plot(rules, method = "paracoord")
     lhs              rhs         support  confidence lift  count
[1]  {Bread}          => {Wine}   0.28     0.66       0.93  2    
[2]  {Bread}          => {Butter} 0.42     1          1.16  3    
[3]  {Cheese}         => {Wine}   0.42     0.75       1.05  3    
[4]  {Wine}           => {Cheese} 0.42     0.6        1.05  3    
[5]  {Cheese}         => {Butter} 0.42     0.75       0.87  3    
[6]  {Wine}           => {Butter} 0.57     0.8        0.93  4    
[7]  {Butter}         => {Wine}   0.57     0.66       0.93  4    
[8]  {Bread,Cheese}   => {Wine}   0.14     1          1.4   1    
[9]  {Bread,Cheese}   => {Butter} 0.14     1          1.16  1    
[10] {Bread,Wine}     => {Butter} 0.28     1          1.16  2    
...

Parallel coordinates plot

parallel_coordinates

Market Basket Analysis in R

ruleExplorer: the Swiss Army knife

Shiny app

ruleExplorer(rules)

Available plots:

  • Data table
  • Scatter
  • Matrix
  • Grouped
  • Graph

shiny_rule_explorer

Market Basket Analysis in R

More on Shiny

Market Basket Analysis in R

Let's ruleExplore!

Market Basket Analysis in R

Preparing Video For Download...