From ab10a2c03d21b0487889c0dd26045c148d75cb93 Mon Sep 17 00:00:00 2001 From: Yogi Kiran Date: Sat, 27 Mar 2021 19:21:42 +0530 Subject: [PATCH] Frozen sets correction --- FPTree-algorithm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FPTree-algorithm.py b/FPTree-algorithm.py index bf8cc2e..dc8bf0a 100644 --- a/FPTree-algorithm.py +++ b/FPTree-algorithm.py @@ -17,7 +17,10 @@ def Load_data(filename): def create_initialset(dataset): retDict = {} for trans in dataset: - retDict[frozenset(trans)] = 1 + if frozenset(trans) in retDict.keys(): + retDict[frozenset(trans)] += 1 + else: + retDict[frozenset(trans)] = 1 return retDict #class of FP TREE node