@Test public void test() { System.out.println("ARM"); FPTree tree = FPTree.of(3, itemsets); List<AssociationRule> rules = ARM.apply(0.5, tree).collect(Collectors.toList()); assertEquals(9, rules.size()); assertEquals(0.6, rules.get(0).support, 1E-2); assertEquals(0.75, rules.get(0).confidence, 1E-2); assertEquals(1, rules.get(0).antecedent.length); assertEquals(3, rules.get(0).antecedent[0]); assertEquals(1, rules.get(0).consequent.length); assertEquals(2, rules.get(0).consequent[0]); assertEquals(0.3, rules.get(4).support, 1E-2); assertEquals(0.6, rules.get(4).confidence, 1E-2); assertEquals(1, rules.get(4).antecedent.length); assertEquals(1, rules.get(4).antecedent[0]); assertEquals(1, rules.get(4).consequent.length); assertEquals(2, rules.get(4).consequent[0]); assertEquals(0.3, rules.get(8).support, 1E-2); assertEquals(0.6, rules.get(8).confidence, 1E-2); assertEquals(1, rules.get(8).antecedent.length); assertEquals(1, rules.get(8).antecedent[0]); assertEquals(2, rules.get(8).consequent.length); assertEquals(3, rules.get(8).consequent[0]); assertEquals(2, rules.get(8).consequent[1]); }
public static Stream<AssociationRule> apply(double confidence, FPTree tree) { TotalSupportTree ttree = new TotalSupportTree(tree); ARM arm = new ARM(confidence, ttree); return StreamSupport.stream(arm.spliterator(), false); }
ARM implements Iterable<AssociationRule> { public static Stream<AssociationRule> apply(double confidence, FPTree tree) { TotalSupportTree ttree = new TotalSupportTree(tree); ARM arm = new ARM(confidence, ttree); return StreamSupport.stream(arm.spliterator(), false); } }
ARM implements Iterable<AssociationRule> { public static Stream<AssociationRule> apply(double confidence, FPTree tree) { TotalSupportTree ttree = new TotalSupportTree(tree); ARM arm = new ARM(confidence, ttree); return StreamSupport.stream(arm.spliterator(), false); } ARM(double confidence, TotalSupportTree ttree); }
ARM implements Iterable<AssociationRule> { public static Stream<AssociationRule> apply(double confidence, FPTree tree) { TotalSupportTree ttree = new TotalSupportTree(tree); ARM arm = new ARM(confidence, ttree); return StreamSupport.stream(arm.spliterator(), false); } ARM(double confidence, TotalSupportTree ttree); @Override Iterator<AssociationRule> iterator(); static Stream<AssociationRule> apply(double confidence, FPTree tree); }
ARM implements Iterable<AssociationRule> { public static Stream<AssociationRule> apply(double confidence, FPTree tree) { TotalSupportTree ttree = new TotalSupportTree(tree); ARM arm = new ARM(confidence, ttree); return StreamSupport.stream(arm.spliterator(), false); } ARM(double confidence, TotalSupportTree ttree); @Override Iterator<AssociationRule> iterator(); static Stream<AssociationRule> apply(double confidence, FPTree tree);  }