1
1 Frequent Itemset Mining: Computation Model uTypically, data is kept in a flat file rather than a database system. wStored on disk. wStored basket-by-basket. uThe true cost of mining disk- resident data is usually the number of disk I/O’s. uIn practice, association-rule algorithms read the data in passes – all baskets read in turn. uThus, we measure the cost by the number of passes an algorithm takes. Item Basket 1 Basket 2 Basket 3 Etc. Slide based on www.mmds.org

2
2 Main-Memory Bottleneck uFor many frequent-itemset algorithms, main memory is the critical resource. wAs we read baskets, we need to count something, e.g., occurrences of pairs. wThe number of different things we can count is limited by main memory. wSwapping counts in/out is a disaster. Slide based on www.mmds.org

3
3 Finding Frequent Pairs uThe hardest problem often turns out to be finding the frequent pairs. uWe’ll concentrate on how to do that, then discuss extensions to finding frequent triples, etc. Slide based on www.mmds.org

4
4 Naïve Algorithm uRead file once, counting in main memory the occurrences of each pair. wFrom each basket of n items, generate its n (n -1)/2 pairs by two nested loops. uFails if (#items) 2 exceeds main memory. wRemember: #items can be 100K (Wal- Mart) or 10B (Web pages). Slide based on www.mmds.org

10
10 Details of Approach #2 uTotal bytes used is about 12p, where p is the number of pairs that actually occur. wBeats triangular matrix if at most 1/3 of possible pairs actually occur. uMay require extra space for retrieval structure, e.g., a hash table. Slide based on www.mmds.org

12
12 Apriori Algorithm for pairs– (1) uA two-pass approach called a-priori limits the need for main memory. uKey idea: monotonicity : if a set of items appears at least s times, so does every subset. wContrapositive for pairs: if item i does not appear in s baskets, then no pair including i can appear in s baskets. Slide based on www.mmds.org

13
13 Apriori Algorithm for pairs– (2) uPass 1: Read baskets and count in main memory the occurrences of each item. wRequires only memory proportional to #items. uPass 2: Read baskets again and count in main memory only those pairs whose both elements were found in Pass 1 to be frequent. wRequires memory proportional to square of frequent items only. Slide based on www.mmds.org

14
14 Detail for A-Priori uYou can use the triangular matrix method with n = number of frequent items. uTrick: number frequent items 1,2,… and keep a table relating new numbers to original item numbers. Slide based on www.mmds.org

15
15 Frequent Triples, Etc. uFor each k, we construct two sets of k –itemsets: wC k = candidate k - itemsets = those that might be frequent (support > s ) based on information from the pass for k –1. wF k = the set of truly frequent k - itemsets. C1C1 F1F1 C2C2 F2F2 C3C3 Filter Construct First pass Second pass All items All pairs of items from F 1 Count the pairs To be explained Count the items Slide based on www.mmds.org

16
16 Full Apriori Algorithm wLet k =1 wGenerate frequent itemsets of length 1 wRepeat until no new frequent itemsets are found k=k+1 1.Generate length k candidate itemsets from length k -1 frequent itemsets 2.Prune candidate itemsets containing subsets of length k -1 that are infrequent 3.Count the support of each candidate by scanning the DB and eliminate candidates that are infrequent, leaving only those that are frequent Slide based on www.mmds.org

17
17 Illustrating Apriori Suppose AB is not in F 2. All these will either not be generated by Step 1 as candidates in C 3, or will be pruned in Step 2.

18
18 Candidate generation 1.Must ensure that the candidate set is complete. 2.Should not generate the same candidate itemset more than once. Slide based on www.mmds.org

20
20 F k-1  F 1 Method uExtend each frequent (k - 1)­itemset with a frequent 1-itemset. uIs it complete? uYes, because every frequent k­itemset is composed of wa frequent (k-1)­itemset and wa frequent 1­itemset. uHowever, it doesn’t prevent the same candidate itemset from being generated more than once. wE.g., {Bread, Diapers, Milk} can be generated by merging w{Bread, Diapers} with {Milk}, w{Bread, Milk} with {Diapers}, or w{Diapers, Milk} with {Bread}.

21
21 Lexicographic Order uKeep frequent itemset sorted in lexicographic order. uEach frequent (k-1)­itemset X is extended with frequent items that are lexicographically larger than the items in X. Example u{Bread, Diapers} can be extended with {Milk} u{Bread, Milk} can’t be extended with {Diapers} u{Diapers, Milk} can’t be extended with {Bread} uWhy is it complete?

25
25 F k-1  F k-1 Method uWe don’t merge {Beer, Diapers} with {Diapers, Milk} because the first item in both itemsets is different. But, is this "don't merge" decision Ok? uIndeed, if {Beer, Diapers, Milk} is a viable candidate, it would have been obtained by merging {Beer, Diapers} with {Beer, Milk} instead. Pruning uBecause each candidate is obtained by merging a pair of frequent (k-1)­itemsets, an additional candidate pruning step is needed to ensure that the remaining k-2 subsets of k-1 elements are frequent.

About project

Feedback

To ensure the functioning of the site, we use cookies. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy &amp Terms.
Your consent to our cookies if you continue to use this website.