Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42c9856

Browse files
author
Eric Naeseth
committed
Clarity change to code within find_frequent_itemsets.
1 parent b238a53 commit 42c9856

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fp_growth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ def clean_transaction(transaction):
4646
transaction.sort(key=lambda v: items[v], reverse=True)
4747
return transaction
4848

49-
tree = FPTree()
49+
master = FPTree()
5050
for transaction in imap(clean_transaction, processed_transactions):
51-
tree.add(transaction)
51+
master.add(transaction)
5252

5353
def find_with_suffix(tree, suffix):
5454
for item, nodes in tree.items():
@@ -66,7 +66,7 @@ def find_with_suffix(tree, suffix):
6666
yield s # pass along the good news to our caller
6767

6868
# Search for frequent itemsets, and yield the results we find.
69-
for s in find_with_suffix(tree, []):
69+
for s in find_with_suffix(master, []):
7070
yield s
7171

7272
class FPTree(object):

0 commit comments

Comments
 (0)