cs6220 data mining techniques
play

CS6220: DATA MINING TECHNIQUES Set Data: Frequent Pattern Mining - PowerPoint PPT Presentation

CS6220: DATA MINING TECHNIQUES Set Data: Frequent Pattern Mining Instructor: Yizhou Sun yzsun@ccs.neu.edu October 22, 2013 Reminder Homework 1 The winner is Sumit Ravinder Raina Highest accuracy: 86.693% Follow the submission


  1. CS6220: DATA MINING TECHNIQUES Set Data: Frequent Pattern Mining Instructor: Yizhou Sun yzsun@ccs.neu.edu October 22, 2013

  2. Reminder • Homework 1 The winner is Sumit Ravinder Raina  • Highest accuracy: 86.693% • Follow the submission rules! • Late submission issue: "within 1 hour late: 90% max; within 8 hours late: 60% max; otherwise: 0%". • Homework 2 due date • Monday night (Oct. 28) • Midterm • Tuesday (Nov. 5, two weeks later), 2-hour (6-8pm) in class • Closed-book exam, and one A4 size cheating sheet is allowed • Bring a calculator (NO cell phone) • Cover to next lecture 2

  3. Quiz of Last Week What is the advantage and disadvantage of k-medoids over k- 1. means? Suppose under a parameter setting for DBSCAN, we get the 2. following clustering results. How shall we change the two parameters (eps and minpts) if we want to get two clusters? Increase eps or reduce minpts! 3

  4. Results of Q2 • 11 / 38 are correct • 10 / 38 are half correct • 17 / 38 are incorrect 4

  5. Mining Frequent Patterns, Association and Correlations • Basic Concepts • Frequent Itemset Mining Methods • Pattern Evaluation Methods • Summary 5

  6. Set Data • A data point corresponds to a set of items Tid Items bought 10 Beer, Nuts, Diaper 20 Beer, Coffee, Diaper 30 Beer, Diaper, Eggs 40 Nuts, Eggs, Milk 50 Nuts, Coffee, Diaper, Eggs, Milk 6

  7. What Is Frequent Pattern Analysis? • Frequent pattern: a pattern (a set of items, subsequences, substructures, etc.) that occurs frequently in a data set • First proposed by Agrawal, Imielinski, and Swami [AIS93] in the context of frequent itemsets and association rule mining • Motivation: Finding inherent regularities in data • What products were often purchased together? — Beer and diapers?! • What are the subsequent purchases after buying a PC? • What kinds of DNA are sensitive to this new drug? 7

  8. Why Is Freq. Pattern Mining Important? • Freq. pattern: An intrinsic and important property of datasets • Foundation for many essential data mining tasks • Association, correlation, and causality analysis • Sequential, structural (e.g., sub-graph) patterns • Pattern analysis in spatiotemporal, multimedia, time-series, and stream data • Classification: discriminative, frequent pattern analysis • Cluster analysis: frequent pattern-based clustering • Broad applications 8

  9. Basic Concepts: Frequent Patterns Tid Items bought • itemset: A set of one or more items 10 Beer, Nuts, Diaper • k-itemset X = {x 1 , …, x k } 20 Beer, Coffee, Diaper • (absolute) support , or, support count 30 Beer, Diaper, Eggs of X: Frequency or occurrence of an 40 Nuts, Eggs, Milk itemset X 50 Nuts, Coffee, Diaper, Eggs, Milk • (relative) support , s , is the fraction of transactions that contains X (i.e., the Customer Customer probability that a transaction buys both buys diaper contains X) • An itemset X is frequent if X’s support is no less than a minsup threshold Customer buys beer 9

  10. Basic Concepts: Association Rules Find all the rules X  Y with • minimum support and confidence Tid Items bought 10 Beer, Nuts, Diaper • support, s , probability that a 20 Beer, Coffee, Diaper transaction contains X  Y 30 Beer, Diaper, Eggs • confidence, c, conditional 40 Nuts, Eggs, Milk Nuts, Coffee, Diaper, Eggs, Milk 50 probability that a transaction having X also contains Y Customer Customer buys both buys Let minsup = 50%, minconf = 50% diaper Freq. Pat.: Beer:3, Nuts:3, Diaper:4, Eggs:3, {Beer, Diaper}:3 Customer Strong Association rules  buys beer Beer  Diaper (60%, 100%)  Diaper  Beer (60%, 75%)  10

  11. Closed Patterns and Max-Patterns • A long pattern contains a combinatorial number of sub-patterns, e.g., {a 1 , …, a 100 } contains 2 100 – 1 = 1.27*10 30 sub-patterns! • Solution: Mine closed patterns and max-patterns instead • An itemset X is closed if X is frequent and there exists no super- pattern Y כ X, with the same support as X (proposed by Pasquier, et al. @ ICDT’ 99) • An itemset X is a max-pattern if X is frequent and there exists no frequent super-pattern Y כ X (proposed by Bayardo @ SIGMOD’ 98) • Closed pattern is a lossless compression of freq. patterns • Reducing the # of patterns and rules 11

  12. Closed Patterns and Max-Patterns • Exercise. DB = {<a 1 , …, a 100 >, < a 1 , …, a 50 >} • Min_sup = 1. • What is the set of closed itemset? • <a 1 , …, a 100 >: 1 • < a 1 , …, a 50 >: 2 • What is the set of max-pattern? • <a 1 , …, a 100 >: 1 • What is the set of all patterns? • !! 12

  13. Computational Complexity of Frequent Itemset Mining • How many itemsets are potentially to be generated in the worst case? • The number of frequent itemsets to be generated is sensitive to the minsup threshold • When minsup is low, there exist potentially an exponential number of frequent itemsets • The worst case: M N where M: # distinct items, and N: max length of transactions 13

  14. • The worst case complexity vs. the expected probability • Ex. Suppose Walmart has 10 4 kinds of products • The chance to pick up one product 10 -4 • The chance to pick up a particular set of 10 products: ~10 -40 • What is the chance this particular set of 10 products to be frequent, i.e., appearing 10 3 times in 10 9 transactions? 14

  15. Mining Frequent Patterns, Association and Correlations • Basic Concepts • Frequent Itemset Mining Methods • Pattern Evaluation Methods • Summary 15

  16. Scalable Frequent Itemset Mining Methods • Apriori: A Candidate Generation-and-Test Approach • Improving the Efficiency of Apriori • FPGrowth: A Frequent Pattern-Growth Approach • ECLAT: Frequent Pattern Mining with Vertical Data Format • Generating Association Rules 16

  17. The Apriori Property and Scalable Mining Methods • The Apriori property of frequent patterns • Any nonempty subsets of a frequent itemset must be frequent • If {be beer, r, diap aper, , nut uts} s} is frequent, so is {be beer, r, diap aper} r} • i.e., every transaction having {beer, diaper, nuts} also contains {beer, diaper} • Scalable mining methods: Three major approaches • Apriori (Agrawal & Srikant@VLDB’94) • Freq. pattern growth (FPgrowth —Han, Pei & Yin @SIGMOD’00) • Vertical data format approach (Eclat) 17

  18. Apriori: A Candidate Generation & Test Approach • Apriori pruning principle: If there is any itemset which is infrequent, its superset should not be generated/tested! (Agrawal & Srikant @VLDB’ 94, Mannila , et al. @ KDD’ 94) • Method: • Initially, scan DB once to get frequent 1-itemset • Generate length (k+1) candidate itemsets from length k frequent itemsets • Test the candidates against DB • Terminate when no frequent or candidate set can be generated 18

  19. From Frequent k-1 Itemset To Frequent k-Itemset C k : Candidate itemset of size k L k : frequent itemset of size k • From 𝑀 𝑙−1 to 𝐷 𝑙 (Candidates Generation) • The join step • The prune step • From 𝐷 𝑙 to 𝑀 𝑙 • Test candidates by scanning database 19

  20. The Apriori Algorithm — An Example Sup min = 2 Itemset sup Itemset sup Database TDB {A} 2 L 1 {A} 2 Tid Items C 1 {B} 3 {B} 3 10 A, C, D {C} 3 {C} 3 1 st scan 20 B, C, E {D} 1 {E} 3 30 A, B, C, E {E} 3 40 B, E Itemset sup C 2 C 2 Itemset {A, B} 1 Itemset sup L 2 2 nd scan {A, B} {A, C} 2 {A, C} 2 {A, C} {A, E} 1 {B, C} 2 {A, E} {B, C} 2 {B, E} 3 {B, C} {B, E} 3 {C, E} 2 {C, E} 2 {B, E} {C, E} Itemset sup Itemset L 3 C 3 3 rd scan {B, C, E} 2 {B, C, E} 20

  21. The Apriori Algorithm ( Pseudo-Code) C k : Candidate itemset of size k L k : frequent itemset of size k L 1 = {frequent items}; for ( k = 2; L k-1 !=  ; k ++) do begin C k = candidates generated from L k-1 ; for each transaction t in database do increment the count of all candidates in C k+1 that are contained in t L k+1 = candidates in C k+1 with min_support end return  k L k ; 21

  22. Candidates Generation Assume a pre-specified order of items • How to generate candidates C k ? • Step 1: self-joining L k-1 • Two length k-1 itemsets 𝑚 1 and 𝑚 2 can join, only if the first k- 2 items are the same, and the for the last term, 𝑚 1 𝑙 − 1 < 𝑚 2 𝑙 − 1 (why?) • Step 2: pruning • Why we need pruning for candidates? • How? • Again, use Apriori property • A candidate itemset can be safely pruned, if it contains infrequent subset 22

  23. • Example of Candidate-generation from L 3 to C 4 • L 3 = { abc, abd, acd, ace, bcd } • Self-joining: L 3 *L 3 • abcd from abc and abd • acde from acd and ace • Pruning: • acde is removed because ade is not in L 3 • C 4 = { abcd } 23

  24. The Apriori Algorithm — Example Review Sup min = 2 Itemset sup Itemset sup Database TDB {A} 2 L 1 {A} 2 Tid Items C 1 {B} 3 {B} 3 10 A, C, D {C} 3 {C} 3 1 st scan 20 B, C, E {D} 1 {E} 3 30 A, B, C, E {E} 3 40 B, E Itemset sup C 2 C 2 Itemset {A, B} 1 Itemset sup L 2 2 nd scan {A, B} {A, C} 2 {A, C} 2 {A, C} {A, E} 1 {B, C} 2 {A, E} {B, C} 2 {B, E} 3 {B, C} {B, E} 3 {C, E} 2 {C, E} 2 {B, E} {C, E} Itemset sup Itemset L 3 C 3 3 rd scan {B, C, E} 2 {B, C, E} 24

  25. Questions • How many scans on DB are needed for Apriori algorithm? • When (k = ?) does Apriori algorithm generate most candidate itemsets? • Is support counting for candidates expensive? 25

Recommend


More recommend