implemented phase 2

This commit is contained in:
IGI-111
2015-04-05 17:55:16 +02:00
parent 32309510a8
commit c108e32c89
5 changed files with 83 additions and 17 deletions

20
phase2.hs Normal file
View File

@@ -0,0 +1,20 @@
import CSVParser
import FrequentPatterns
import DataModel
import ExtractRules
import qualified Data.Set as Set
import System.Environment(getArgs)
import Control.Monad(when)
main :: IO()
main = do
args <- getArgs
when (2 /= length args) (error "Usage: phase2 <file.csv> <threshold>")
let filename = head args
let threshold = read $ last args
file <- readFile filename
case parseCSV file of
Left _ -> error "Could not parse out.csv"
Right val -> print $ extractRules threshold $
filter (/= empty) $ concat $ frequentPatterns 0.01 table where
table = map (ItemSet. Set.fromList .map Item) val