充分利用购物篮分析

R 中的购物篮分析

Christopher Bruffaerts

Statistician

购物篮分析实战

理解客户/用户

  • 了解哪些商品会被一起购买
  • 提取规则集
  • 推断商品间关系

MBA 的进阶

  • 添加客户/用户信息
  • 按偏好对客户分群(聚类)

向客户/用户推荐

  • 线下场景:在店内将经常一起购买的商品相邻陈列。
  • 线上场景:在同一页面展示关联商品,一键可达。
R 中的购物篮分析

是什么影响了酸奶?

以酸奶为后件(consequent)

# 提取右侧为 Yogurt 的规则
yogurt_rules_rhs = apriori(Groceries, parameter = list(supp = 0.001,conf = 0.8),
                           appearance = list(default = "lhs",rhs = "yogurt"))
# 按 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
R 中的购物篮分析

酸奶影响了什么?

以酸奶为前件(antecedent)

# 提取左侧为 Yogurt 的规则
yogurt_rules_lhs = apriori(Groceries, parameter = list(supp = 0.001, conf = 0.8, minlen = 2), 
                                appearance = list(default = "rhs",lhs = "yogurt"))
# 规则摘要
summary(yogurt_rules_lhs)
set of 0 rules
R 中的购物篮分析

来为电影找出推荐!

R 中的购物篮分析

Preparing Video For Download...