예제 #1
0
 def test_apriori(self):
     # Assert frequent sets frequency.
     v = vector.apriori(([1, 2, 4], [1, 2, 5], [1, 3, 6], [1, 3, 7]), support=0.5)
     self.assertTrue(len(v), 3)
     self.assertEqual(v[frozenset((1,))], 1.0)
     self.assertEqual(v[frozenset((1, 2))], 0.5)
     self.assertEqual(v[frozenset((2,))], 0.5)
     self.assertEqual(v[frozenset((3,))], 0.5)
예제 #2
0
 def test_apriori(self):
     # Assert frequent sets frequency.
     v = vector.apriori(([1, 2, 4], [1, 2, 5], [1, 3, 6], [1, 3, 7]),
                        support=0.5)
     self.assertTrue(len(v), 3)
     self.assertEqual(v[frozenset((1, ))], 1.0)
     self.assertEqual(v[frozenset((1, 2))], 0.5)
     self.assertEqual(v[frozenset((2, ))], 0.5)
     self.assertEqual(v[frozenset((3, ))], 0.5)