def test_sam(self): ts1 = perftesting.get_default_transactions() sam_input = itemmining.get_sam_input(ts1) report = itemmining.sam(sam_input, 2) self.assertEqual(17, len(report)) self.assertEqual(6, report[frozenset(['b', 'd'])]) ts2 = perftesting.get_default_transactions_alt() sam_input = itemmining.get_sam_input(ts2) report = itemmining.sam(sam_input, 2) self.assertEqual(19, len(report)) self.assertEqual(5, report[frozenset(['a', 'b'])])
def test_sam(should_print=False, ts=None, support=2): if ts is None: ts = get_default_transactions() sam_input = get_sam_input(ts, lambda e: e) fis = set() report = {} n = _sam(sam_input, fis, report, support) if should_print: print(n) print(report) return (n, report)