www.pudn.com > fp_growth_source.rar > Test.java
package association.fptree; import java.io.File; /** * 测试* 用FP-Growth算法产生的项集全部存储在项集树itr中, * */ public class Test { public static void main(String args[]){ ITree itr; //存储所有项集的树 File f; FPGrowth fpg=new FPGrowth(); FPTree pt =new FPTree(); CreateFPTree c =new CreateFPTree(); int support=1; String fileName=""; try{ support=Integer.parseInt(args[0].trim()); fileName=args[1].trim(); if (support<0){ System.out.println("支持度阈值不能是负值"); System.exit(1); } }catch(Exception e){ System.out.println("参数输入错误"); System.exit(1); } c.SetFPTree(pt); f=new File(fileName); c.start(f); //从事务文件f中产生FP_Tree pt itr=new ITree(); fpg.Start(pt,itr,support); //用FP-Growth算法产生项集存储在项集树(ITree)itr System.out.println("----频繁项集----"); itr.print(itr.head,new Stack()); } }