关联规则
关联规则
项的集合T={I1,I2,...Im} 事务集D 每个事务t∈D, t由T中某些项组成。
关联规则:A=>B
support(A=>B)=P(A∪B)
confidence(A=>B)=P(B|A)=support(A∪B)/support(A)=count(A∪B)/count(A)
frequent/large itemset: support>threshold
我们要找的就是interesting association rules: support>=threshold1 && confidence>=threshold2
也就是说,(1)在D中AB同时出现足够频繁,(2)在A条件下B出现足够频繁 => interesting
(1)找满足support的C=A∪B,有2m种组合。(2)从C中找A与B
(1)开销>>(2)开销 =>关注于频繁项集寻找 => Apriori算法
Apriori算法-寻找频繁项集
<1>itemset S 是频繁项集 => subset 是频繁项集
<2>itemset S 非频繁项集 => superset 非频繁项集
Lk-大小为k的频繁项集,Ck-由Lk-1的所有组合
具体流程: join step => prune step => join step => ... until ∅
C1=所有一项集
C1=>L1(C1中support满足项集)
L1=>C2(L1中所有组合)
C2=>L2(C2中support满足项集)
....
停止条件:Lk为空
频繁项集=>关联规则
对所有频繁项集t,产生所有非空子集
对t的每个非空子集s,计算confidence=count(t)/count(s),如果满足则产生规则 s=>(t-s)