人工智能入门-R语言数据分析83

Apriori算法 — 例子

人工智能入门-R语言数据分析83
 

 

如何生成候选集

ß假定 Lk-1 中的项按顺序排列

第一步: 自连接 Lk-1

insert into Ck

select p.item1, p.item2, …, p.itemk-1, q.itemk-1

from Lk-1p, Lk-1 q

where p.item1=q.item1, …, p.itemk-2=q.itemk-2, p.itemk-1< q.itemk-1

 

第二步: 修剪

For all itemsetsc in Ckdo

For all (k-1)-subsets s of c do

 

if (s is not in Lk-1) then delete cfrom Ck