def testOneToOne(self):
        data = [
            association_rules.Itemset(["a"], 4),
            association_rules.Itemset(["b"], 2),
            association_rules.Itemset(["a", "b"], 2),
        ]
        actual = association_rules.find_association_rules(data, 0.1)

        expected = [association_rules.Rule(["b"], ["a"], 2, 1.0), association_rules.Rule(["a"], ["b"], 4, 0.5)]
        self.assertEqual(expected, actual)
Exemplo n.º 2
0
    def testOneToOne(self):
        data = [
            association_rules.Itemset(['a'], 4),
            association_rules.Itemset(['b'], 2),
            association_rules.Itemset(['a', 'b'], 2),
        ]
        actual = association_rules.find_association_rules(data, 0.1)

        expected = [
            association_rules.Rule(['b'], ['a'], 2, 1.0),
            association_rules.Rule(['a'], ['b'], 4, 0.5),
        ]
        self.assertEqual(expected, actual)
Exemplo n.º 3
0
 def testEmpty(self):
     actual = association_rules.find_association_rules([], 0.1)
     self.assertEqual([], actual)
 def testEmpty(self):
     actual = association_rules.find_association_rules([], 0.1)
     self.assertEqual([], actual)