【问题标题】:Post-processing of rules from arules对来自 arules 的规则进行后处理
【发布时间】:2015-04-01 14:15:26
【问题描述】:

有没有办法在 arules 包中由apriori 生成的单个规则中使用多个级别的单个变量?

考虑以下示例:

df <- read.table(header = TRUE, text = '
V1 V2 V3
a d x 
a d x           
a d y        
b d x       
b d x       
b d y
a e y
a e y
a e x
b e y
b e y
b e x
c d y
')

library(arules)    
rules <- apriori(df, 
                 parameter = list(support= 0.001, confidence = 0.5, target = "rules"),
                 appearance = list(rhs=c("V3=x"), default = 'lhs'))
inspect(sort(rules, decreasing = TRUE, by = "confidence"))

输出>

  lhs       rhs      support confidence     lift
1 {V1=a,                                        
   V2=d} => {V3=x} 0.1538462  0.6666667 1.444444
2 {V1=b,                                        
   V2=d} => {V3=x} 0.1538462  0.6666667 1.444444
3 {V2=d} => {V3=x} 0.3076923  0.5714286 1.238095
4 {V1=a} => {V3=x} 0.2307692  0.5000000 1.083333
5 {V1=b} => {V3=x} 0.2307692  0.5000000 1.083333

在这个例子中,如果我得到规则 {V1=a,b,V2=d} 会很有帮助。其他一些工具(例如LISp-Miner)可以生成使用多级变量的规则。

【问题讨论】:

    标签: r apriori arules


    【解决方案1】:

    arules 遵循标准的关联规则挖掘文献,不会以这种方式聚合项目。项集确实包含或不包含项。因此,除非您手动添加人造物品V1=aORb,否则您会受到两条规则的限制。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-15
      • 2011-09-28
      相关资源
      最近更新 更多