def testPruning(self): self.tree.add('abc') self.tree.add('abd') self.tree.add('ac') self.tree.add('abe') self.tree.add('dc') paths = list(self.tree.prefix_paths('c')) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) root.child('a', 2).child('b', 1).child('c', 1).leaf() self.assertEqual(2, len(root.node.children))
def testSupport(self): """ Issue #2: incorrect support calculation for shared paths """ self.tree.add('abcd') self.tree.add('abd') paths = list(self.tree.prefix_paths('d')) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) a = root.child('a', 2) b = a.child('b', 2) c = b.child('c', 1)
def testSupport(self): """ Issue #2: incorrect support calculation for shared paths """ self.tree.add('abcd') self.tree.add('abd') paths = list(self.tree.prefix_paths('d')) ct = fp_growth.conditional_tree_from_paths(paths, 1) root = NodeTester(self,ct.root) a = root.child('a',2) b = a.child('b',2) c = b.child('c',1)
def testPruning(self): self.tree.add('abc') self.tree.add('abd') self.tree.add('ac') self.tree.add('abe') self.tree.add('dc') paths = list(self.tree.prefix_paths('c')) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) root.child('a', 2).child('b',1).child('c',1).leaf() self.assertEqual(2, len(root.node.children))
def testSupport(self): """ Issue #2: incorrect support calculation for shared paths """ self.tree.add("abcd") self.tree.add("abd") paths = list(self.tree.prefix_paths("d")) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) a = root.child("a", 2) b = a.child("b", 2) c = b.child("c", 1)
def testPruning(self): self.tree.add("abc") self.tree.add("abd") self.tree.add("ac") self.tree.add("abe") self.tree.add("dc") paths = list(self.tree.prefix_paths("c")) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) root.child("a", 2).child("b", 1).child("c", 1).leaf() self.assertEqual(2, len(root.node.children))
def testGeneration(self): self.tree.add('abc') self.tree.add('abd') self.tree.add('ade') # Test the tree's structure, just because I'm paranoid. b = self.root.child('a', 3).child('b', 2) b.child('c', 1) b.child('d', 1) self.root.child('a').child('d', 1).child('e', 1) paths = list(self.tree.prefix_paths('d')) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) a = root.child('a', 2) a.child('b', 1).child('d', 1).leaf() self.assertEqual(2, len(a.node.children))
def testGeneration(self): self.tree.add('abc') self.tree.add('abd') self.tree.add('ade') # Test the tree's structure, just because I'm paranoid. b = self.root.child('a', 3).child('b', 2) b.child('c', 1) b.child('d', 1) self.root.child('a').child('d', 1).child('e', 1) paths = list(self.tree.prefix_paths('d')) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) a = root.child('a', 2) a.child('b', 1).child('d',1).leaf() self.assertEqual(2, len(a.node.children))
def testGeneration(self): self.tree.add("abc") self.tree.add("abd") self.tree.add("ade") # Test the tree's structure, just because I'm paranoid. b = self.root.child("a", 3).child("b", 2) b.child("c", 1) b.child("d", 1) self.root.child("a").child("d", 1).child("e", 1) paths = list(self.tree.prefix_paths("d")) ct = fp_growth.conditional_tree_from_paths(paths) root = NodeTester(self, ct.root) a = root.child("a", 2) a.child("b", 1).child("d", 1).leaf() self.assertEqual(2, len(a.node.children))