Updated Module 3
Updated Module 3
Concepts and
Techniques
(3rd ed.)
— Chapter 3 —
1
Chapter 5: Mining Frequent Patterns,
Association and Correlations: Basic
Concepts and Methods
Basic Concepts
Evaluation Methods
Summary
2
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?
Can we automatically classify web documents?
Applications
Basket data analysis, cross-marketing, catalog design, sale campaign
analysis, Web log (click stream) analysis, and DNA sequence analysis.
3
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
Data warehousing: iceberg cube and cube-gradient
Semantic data compression: fascicles
Broad applications
4
Basic Concepts: Frequent
Patterns
7
Closed Patterns and Max-
Patterns
Exercise. DB = {<a1, …, a100>, < a1, …, a50>}
Min_sup = 1.
What is the set of closed itemset?
<a1, …, a100>: 1
< a1, …, a50>: 2
What is the set of max-pattern?
<a1, …, a100>: 1
What is the set of all patterns?
!!
8
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 senstive to
the minsup threshold
When minsup is low, there exist potentially an exponential
number of frequent itemsets
The worst case: MN where M: # distinct items, and N: max length
of transactions
The worst case complexty vs. the expected probability
Ex. Suppose Walmart has 104 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 103 times in 109 transactions?
9
Chapter 5: Mining Frequent Patterns,
Association and Correlations: Basic
Concepts and Methods
Basic Concepts
Evaluation Methods
Summary
10
Scalable Frequent Itemset Mining
Methods
Approach
Approach
Data Format
11
The Downward Closure Property and
Scalable Mining Methods
The downward closure property of frequent patterns
Any subset of a frequent itemset must be
frequent
If {beer, diaper, nuts} is frequent, so is {beer,
diaper}
i.e., every transaction having {beer, diaper, nuts}
@SIGMOD’00)
Vertical data format approach (Charm—Zaki &
Hsiao @SDM’02) 12
Apriori: A Candidate Generation & Test
Approach
C3 Itemset
3rd scan L3 Itemset sup
{B, C, E} {B, C, E} 2
14
The Apriori Algorithm (Pseudo-
Code)
L1 = {frequent items};
for (k = 1; Lk !=; k++) do begin
Ck+1 = candidates generated from Lk;
for each transaction t in database do
increment the count of all candidates in Ck+1
that are contained in t
Lk+1 = candidates in Ck+1 with min_support
end
return k Lk; 15
Implementation of Apriori
How to generate candidates?
Step 1: self-joining Lk
Step 2: pruning
Example of Candidate-generation
L3={abc, abd, acd, ace, bcd}
Self-joining: L3*L3
abcd from abc and abd
acde from acd and ace
Pruning:
acde is removed because ade is not in L3
C4 = {abcd}
16
How to Count Supports of Candidates?
17
Counting Supports of Candidates Using Hash
Tree
Subset function
Transaction: 1 2 3 5 6
3,6,9
1,4,7
2,5,8
1+2356
13+56 234
567
145 345 356 367
136 368
357
12+356
689
124
457 125 159
458
18
Scalable Frequent Itemset Mining
Methods
Format
Format
Patterns containing p
…
Pattern f
24
Find Patterns Having P From P-conditional
Database
{}
Cond. pattern base of “cam”: (f:3) f:3
cam-conditional FP-tree
27
A Special Case: Single Prefix Path in FP-
tree
a3:n3
{} r1
C2:k2 C3:k3
a3:n3 C2:k2 C3:k3
28
Benefits of the FP-tree Structure
Completeness
Preserve complete information for frequent
pattern mining
Never break a long pattern of any transaction
Compactness
Reduce irrelevant info—infrequent items are gone
Items in frequency descending order: the more
frequently occurring, the more likely to be shared
Never be larger than the original database (not
count node-links and the count field)
29
The Frequent Pattern Growth Mining
Method
Idea: Frequent pattern growth
Recursively grow frequent patterns by pattern
conditional FP-tree
Until the resulting FP-tree is empty, or it
30
Scaling FP-growth by Database
Projection
What about if FP-tree cannot fit in memory?
DB projection
First partition a database into a set of projected DBs
Then construct and mine FP-tree for each projected DB
Parallel projection vs. partition projection techniques
Parallel projection
Project the DB in parallel for each frequent item
Parallel projection is space costly
All the partitions can be processed in parallel
Partition projection
Partition the DB based on the ordered frequent items
Passing the unprocessed parts to the subsequent
partitions
31