关联规则算法

Association rules algorithmn

我在 csv 文件中有此交易。


I1,I2,I5  
I2,I4  
I2,I3  
I1,I2,I4  
I1,I3  
I2,I3  
I1,I3  
I1,I2,I3,I5  
I1,I2,I3  

support=0.02confidence=0.8的关联规则是{I1, I2, I3}{I1, I2, I5}。这来自数据挖掘、概念和技术一书。
我用 R 编写了代码,有了这种支持,我只得到一个规则,{I1,I2,I5}


R中的代码:

transactions <- read.transactions("file.csv", sep=",")
m1<-apriori(transactions, parameter = list(support=0.02, minlen=3))
inspect(sort(m1, by="support"))

{I1, I2, I3} 不是关联规则

这是一个常用项集

关联规则的左侧必须是频繁项集,但并非所有频繁项集都会出现在规则的左侧。

所以你不能依靠查看关联规则的 lhs 来找到所有频繁项集。

在您的 Apriori 关联规则中,最后两个规则是从项目集 {I1, I2, I3, I5} 生成的(lhd 和 rhs 的 union 必须是频繁项集)。但同样,如果您想查找频繁项集,请不要依赖关联规则。它们并不完全相同。