Professional Documents
Culture Documents
• Pseudo-code:
Ck: Candidate itemset of size k
Lk : frequent itemset of size k
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
8/1/21 return k Lk; Data Mining: Concepts and 11
Techniques
Important Details of Apriori
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
• Challenges
– Multiple scans of transaction database
– Huge number of candidates
– Tedious workload of support counting for candidates
• Improving Apriori: general ideas
– Reduce passes of transaction database scans
– Shrink number of candidates
– Facilitate support counting of candidates
ABCD
• Once both A and D are determined frequent,
the counting of AD begins
ABC ABD ACD BCD • Once all length-2 subsets of BCD are
determined frequent, the counting of BCD
begins
AB AC BC AD BD CD
Transactions
1-itemsets
A B C D
Apriori 2-itemsets
…
{}
Itemset lattice 1-itemsets
S. Brin R. Motwani, J. Ullman, 2-items
and S. Tsur. Dynamic itemset DIC 3-items
counting and implication rules for
market basket data. In
8/1/21
SIGMOD’97 Data Mining: Concepts and 21
Techniques
Bottleneck of Frequent-
pattern Mining
• Multiple database scans are costly
• Mining long patterns needs many passes of
scanning and generates lots of candidates
– To find frequent itemset i1i2…i100
• # of scans: 100
• # of Candidates: (1001) + (1002) + … + (110000) = 2100-1 =
1.27*1030 !
• Bottleneck: candidate-generation-and-test
• Can we avoid candidate generation?
8/1/21 Data Mining: Concepts and 22
Techniques
Mining Frequent Patterns Without Candidate
Generation
• 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)
– For Connect-4 DB, compression ratio could be over 100
{}
Header Table
f:4 c:1 Conditional pattern bases
Item frequency head
f 4 itemcond. pattern base
c 4 c:3 b:1 b:1 c f:3
a 3
a fc:3
b 3 a:3 p:1
m 3 b fca:1, f:1, c:1
p 3 m:2 b:1 m fca:2, fcab:1
p fcam:2, cb:1
8/1/21
p:2 m:1
Data Mining: Concepts and 27
Techniques
From Conditional Pattern-bases to Conditional FP-trees
c:3
f:3
am-conditional FP-tree
c:3 {}
Cond. pattern base of “cm”: (f:3)
a:3 f:3
m-conditional FP-tree
cm-conditional FP-tree
{}
Cond. pattern base of “cam”: (f:3)
f:3
cam-conditional FP-tree
8/1/21 Data Mining: Concepts and 29
Techniques
A Special Case: Single Prefix Path in FP-tree
a3:n3
{} r1
C2:k2 C3:k3
8/1/21 a3:n3 and
Data Mining: Concepts C2:k2
30 C3:k3
Techniques
Mining Frequent Patterns With FP-trees
Tran. DB
• Parallel projection needs a lot of fcamp
disk space fcabm
fb
• Partition projection saves it cbp
fcamp
am-proj DB cm-proj DB
fc f …
fc f
fc f
8/1/21 Data Mining: Concepts and 33
Techniques
FP-Growth vs. Apriori: Scalability With the Support
Threshold
90 D1 FP-grow th runtime
D1 Apriori runtime
80
Ru n tim e (se c.)
70
60
50
40
30
20
10
0
0 0.5 1 1.5 2 2.5 3
Support threshold(%)
8/1/21 Data Mining: Concepts and 34
Techniques
FP-Growth vs. Tree-Projection: Scalability with the
Support Threshold
100
Runtime (sec.)
80
60
40
20
0
0 0.5 1 1.5 2
8/1/21 Support
Data Mining: threshold
Concepts and (%) 35
Techniques
Why Is FP-Growth the Winner?
• Divide-and-conquer:
– decompose both the mining task and DB according to the
frequent patterns obtained so far
– leads to focused search of smaller databases
• Other factors
– no candidate generation, no candidate test
– compressed database: FP-tree structure
– no repeated scan of entire database
– basic ops—counting local freq items and building sub FP-
tree, no pattern search and matching
– CLOSET (DMKD’00)
• Mining sequential patterns
– A, B, C, D, E 10 A,B,C,D,E
20 B,C,D,E,
• 2nd scan: find support for 30 A,C,D,F
– AB, AC, AD, AE, ABCDE
– BC, BD, BE, BCDE
Potential
– CD, CE, CDE, DE, max-patterns
• Since BCDE is a max-pattern, no need to check BCD, BDE, CDE in
later scan
• R. Bayardo. Efficiently mining long patterns from databases. In
SIGMOD’98
8/1/21 Data Mining: Concepts and 38
Techniques
Mining Frequent Closed Patterns: CLOSET
Level 1
Milk Level 1
min_sup = 5%
[support = 10%] min_sup = 5%
• Single-dimensional rules:
buys(X, “milk”) buys(X, “bread”)
• Multi-dimensional rules: 2 dimensions or predicates
– Inter-dimension assoc. rules (no repeated predicates)
age(X,”19-25”) occupation(X,“student”) buys(X, “coke”)
– hybrid-dimension assoc. rules (repeated predicates)
age(X,”19-25”) buys(X, “popcorn”) buys(X, “coke”)
• Categorical Attributes: finite number of possible values, no
ordering among values—data cube approach
• Quantitative Attributes: numeric, implicit ordering among values
—discretization, clustering, and gradient approaches
8/1/21 Data Mining: Concepts and 50
Techniques
Mining Quantitative Associations
age(X,”34-35”) income(X,”30-50K”)
buys(X,”high resolution TV”)
P ( A B )
lift
P ( A) P ( B ) Milk No Milk Sum (row)
Coffee m, c ~m, c c
sup( X ) No Coffee m, ~c ~m, ~c ~c
all _ conf
max_ item _ sup( X ) Sum(col.) m ~m
• Succinctness:
– Given A1, the set of items satisfying a succinctness
constraint C, then any set S satisfying C is based on A1 ,
i.e., S contains a subset belonging to A1
– Idea: Without looking at the transaction database,
whether an itemset S satisfies constraint C can be
determined based on the selection of items
– min(S.Price) v is succinct
– sum(S.Price) v is not succinct
• Optimization: If C is succinct, C is pre-counting pushable
8/1/21 Data Mining: Concepts and 65
Techniques
The Apriori Algorithm — Example
{2 3} 2 {2 3}
{2 5} 3
{2 5} 3 {2 5}
{3 5} 2
{3 5} 2 {3 5}
C3 itemset Scan D L3 itemset sup Constraint:
8/1/21 {2 3 5} {2 3and5} 2
Data Mining: Concepts 69min{S.price } <= 1
Techniques
Converting “Tough” Constraints
TDB (min_sup=2)
TID Transaction
• Convert tough constraints into anti-
10 a, b, c, d, f
monotone or monotone by properly
20 b, c, d, f, g, h
ordering items 30 a, c, d, e, f
• Examine C: avg(S.profit) 25 40 c, e, f, g
sum(S) v ( a S, a 0 ) yes no no
sum(S) v ( a S, a 0 ) no yes no
range(S) v yes no no
range(S) v no yes no
support(S) no yes no
Monotone
Antimonotone
Strongly
convertible
Succinct
Convertible Convertible
anti-monotone monotone
Inconvertible
• R. Meo, G. Psaila, and S. Ceri. A new SQL-like operator for mining association
rules. VLDB'96.
• B. Lent, A. Swami, and J. Widom. Clustering association rules. ICDE'97.
• A. Savasere, E. Omiecinski, and S. Navathe. Mining for strong negative
associations in a large database of customer transactions. ICDE'98.
• D. Tsur, J. D. Ullman, S. Abitboul, C. Clifton, R. Motwani, and S. Nestorov.
Query flocks: A generalization of association-rule mining. SIGMOD'98.
• F. Korn, A. Labrinidis, Y. Kotidis, and C. Faloutsos. Ratio rules: A new
paradigm for fast, quantifiable data mining. VLDB'98.
• K. Wang, S. Zhou, J. Han. Profit Mining: From Patterns to Actions. EDBT’02.
• J. Han, J. Pei, G. Dong, and K. Wang, Computing Iceberg Data Cubes with
Complex Measures. SIGMOD’ 01.
• W. Wang, H. Lu, J. Feng, and J. X. Yu. Condensed Cube: An Effective
Approach to Reducing Data Cube Size. ICDE'02.
• G. Dong, J. Han, J. Lam, J. Pei, and K. Wang. Mining Multi-Dimensional
Constrained Gradients in Data Cubes. VLDB'01.
• T. Imielinski, L. Khachiyan, and A. Abdulghani. Cubegrades: Generalizing
association rules. DAMI:02.
• L. V. S. Lakshmanan, J. Pei, and J. Han. Quotient Cube: How to Summarize
the Semantics of a Data Cube. VLDB'02.
• D. Xin, J. Han, X. Li, B. W. Wah. Star-Cubing: Computing Iceberg Cubes by
Top-Down and Bottom-Up Integration. VLDB'03.