AprioriTID algorithm

What is AprioriTID?

AprioriTID is an algorithm for discovering frequent itemsets (groups of items appearing frequently) in a transaction database. It was proposed by Agrawal & Srikant (1993).

AprioriTID is a variation of the Apriori algorithm. It was proposed in the same article as Apriori as an alternative implementation of Apriori. It produces the same output as Apriori. But it uses a different mechanism for counting the support of itemsets.

比较Apriori与AprioriTID如下:

数据结构方面:

Apriori算法中,首先利用HashMap<Integer,Integer>存储每个项与其出现的次数之间的映射关系,取出频繁项构成List集合:frequent1. 将此List集合作为生成k=2时候选项的输入。  

除了k=1外,其余k值的每个候选项存储在每个Itemset类的对象中,由List<Itemset>集合candidates统一存储。Itemset类中拥有存、取候选项,存储候选项支持度(support)的各函数。全部的频繁项集对象由List<Itemset>集合level存储。(level自然作为k>2时生成候选项函数的输入)

AprioriTID算法中,用HashMap<Integer,Set<Integer>>存储每个项item与其出现的位置(transaction ID)之间的映射关系,从k=1时,直接将频繁项集存储在Itemset对象中(在对象中有集合存储TID),并用List<Itemset>集合level存储各Itemset对象。Itemset类中增添了transaction ID集合,保存项集所对应的transaction ID。

在算法方面:

AprioriTID算法中,当k>=2时,依旧通过we compare items of itemset1 and itemset2.If they have all the same k-1 items and the last item of itemset1 is smaller than the last item of itemset2, we will combine them to generate a candidate来生成候选项集。查看结合在一起的候选集的共同的tid(common tids),当common tids中元素个数满足minsup则结合在一起的候选集为频繁项,(相比apriori效率提高了一些,apriori是将候选项不断与transaction作比较,计算各候选项支持度)保存频繁项和其对应的common tids到Itemset对象中,统一由List<Itemset>集合candidates存储,通过saveItemset()函数保存频繁项集之后,candidates作为下一次计算k+1时频繁项的输入。  

 

转载于:https://www.cnblogs.com/cnblogs-learn/p/4044381.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值