From 5ba00085d1322f4cade8516f83e9644a31b89ef1 Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Fri, 3 Apr 2015 23:10:11 +0200 Subject: [PATCH] fixed first level of frequent patterns not being filtered --- Apriori.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apriori.hs b/Apriori.hs index 778f09e..45e1e2d 100644 --- a/Apriori.hs +++ b/Apriori.hs @@ -52,5 +52,5 @@ singletons table = Set.toList $ foldr (\(ItemSet row) old -> old `Set.union` row frequentPatterns :: Frequency -> [ItemSet] -> [[ItemSet]] frequentPatterns thresh table = until (\x -> [] == head x) (\x -> filterByFrequency (generateNextLevel (head x)) : x) [firstLevel] where - firstLevel = map (\x -> ItemSet $ Set.fromList [x]) (singletons table) + firstLevel = filterByFrequency $ map (\x -> ItemSet $ Set.fromList [x]) (singletons table) filterByFrequency = filter (\x -> frequency table x >= thresh)