Now, let's try to get the same results with the more efficient FP-Growth algorithm.
FP-Growth is also implemented in the weka.associations package:
import weka.associations.FPGrowth;
The FP-Growth algorithm is initialized similarly, as we did earlier:
FPGrowth fpgModel = new FPGrowth(); fpgModel.buildAssociations(data); System.out.println(fpgModel);
The output reveals that FP-Growth discovered 16 rules:
FPGrowth found 16 rules (displaying top 10) 1. [fruit=t, frozen foods=t, biscuits=t, total=high]: 788 ==> [bread and cake=t]: 723 <conf:(0.92)> lift:(1.27) lev:(0.03) conv:(3.35) 2. [fruit=t, baking needs=t, biscuits=t, total=high]: 760 ==> [bread and cake=t]: 696 <conf:(0.92)> lift:(1.27) lev:(0.03) conv:(3.28) ...
We can observe that FP-Growth found the same set of rules as Apriori; however, the time required to process larger datasets can be significantly shorter.