Making the most of market basket analysis

Market Basket Analysis in R

Christopher Bruffaerts

Statistician

Market basket in practice

Understanding customers/users

  • Understand which items are purchased in combination
  • Extract sets of rules
  • Infer on the relationship between items

The extra mile to MBA

  • Add customer/user information
  • Segment (cluster) customers according to their preferences

Recommendations to customers/users

  • Offline world: placing items strategically in the shop such that items often purchased together are close to each other.
  • Online world: expose related items on the same page, just a click-away.
Market Basket Analysis in R

What influenced yogurt ?

Yogurt as a consequent

# Extract rules with Yogurt on the right side
yogurt_rules_rhs = apriori(Groceries, parameter = list(supp = 0.001,conf = 0.8),
                           appearance = list(default = "lhs",rhs = "yogurt"))
# Find first rules with highest lift
inspect(head(sort(yogurt_rules_rhs, by="lift")))
    lhs                                                         rhs      support     confidence lift     count
[1] {root vegetables,butter,cream cheese }                   => {yogurt} 0.001016777 0.9090909  6.516698 10   
[2] {tropical fruit,whole milk,butter,sliced cheese}         => {yogurt} 0.001016777 0.9090909  6.516698 10   
[3] {other vegetables,curd,whipped/sour cream,cream cheese } => {yogurt} 0.001016777 0.9090909  6.516698 10   
[4] {tropical fruit,other vegetables,butter,white bread}     => {yogurt} 0.001016777 0.9090909  6.516698 10   
[5] {sausage,pip fruit,sliced cheese}                        => {yogurt} 0.001220132 0.8571429  6.144315 12   
[6] {tropical fruit,whole milk,butter,curd}                  => {yogurt} 0.001220132 0.8571429  6.144315 12
Market Basket Analysis in R

What did yogurt influence?

Yogurt as an antecedent

# Extract rules with Yogurt on the left side
yogurt_rules_lhs = apriori(Groceries, parameter = list(supp = 0.001, conf = 0.8, minlen = 2), 
                                appearance = list(default = "rhs",lhs = "yogurt"))
# Summary of rules
summary(yogurt_rules_lhs)
set of 0 rules
Market Basket Analysis in R

Let's find out recommendations for movies!

Market Basket Analysis in R

Preparing Video For Download...