-- 20/03/2014 17:33 - 17:55 (22mins) reading/working example by hand -- 21/03/2014 10:21 - 10:38 (17mins) on paper working out how to do candidate counting. -- 10:57 - 11:10 (13mins) stuck 11:20 unstuck - 11:31 (11mins) total 63mins -- Input data :: Map TID (Map IID ()) or Map (TID,IID) () or Map TID (List IID) ordered asc IID -- T :: Map Int (Map Int ()) -- Ck :: Map (Map Int ()) () -- mapToMany (snd, T) :: Map (Int,Int) () -- Lprev :: Map (Map Int ()) () -- allPairs (mapInit.fst, Lprev) :: Map (Map Int (), Map Int ()) ((),()) -- subsetJoin (fst, snd, Ck, T) :: Map (Map Int (), Int) ((), Map Int ()) let T = ... in let Tnum = count(T) in let minSup = Tnum / 100 in let minNum = 10 in let C1 = groupReduce (\((_,i),_) -> singletonMap i (), \_ -> (), \_ -> (), mapToMany (snd, T)) in let next = \(Lprev, Lacc) -> -- new candidate generation let Ck = map (\((s,_),(v,w)) -> mapInsert (v, mapInsert (w, s)), allPairs (mapInit.fst, Lprev)) in -- count supports for candidates let J = subsetJoin (fst, snd, Ck, T) in let L' = groupReduce (fst.fst, \_ -> 1, addi, J) in -- :: Map (Map Int ()) Int -- keep those with support >= min support let Lnext = filterMap (\(_,cnt) -> gtei (cnd, minSup), L') in let Lacc' = union (Lacc, Lnext) in (Lnext, Lacc') in while (\(L,Lacc) -> (next (L,Lacc), gtei (count(L), minNum)), (C1, emptyMap))