Mining Frequent Patterns Without Candidate Generation
Mining Frequent Patterns Without Candidate Generation
Outline
• Frequent Pattern Mining: Problem statement and an
example
• Review of Apriori-like Approaches
• FP-Growth:
– Overview
– FP-tree:
• structure, construction and advantages
– FP-growth:
• FP-tree conditional pattern bases conditional FP-tree
frequent patterns
• Experiments
• Discussion:
– Improvement of FP-growth
• Conclusion Remarks
2
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Frequent Pattern Mining Problem: Review
Minimum support: ξ =3
3
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Review of Apriori-like Approaches for finding complete frequent item-sets
Apriori
Candidate
• Main Steps of Apriori Algorithm: Generation
4
Mining Frequent Patterns without Candidate Generation. SIGMOD2000
Disadvantages of Apriori-like Approach
5
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Overview: FP-tree based method
6
Mining Frequent Patterns without Candidate Generation (SIGMOD2000))
FP-Tree
FP-tree:
Construction and Design
Construct FP-tree
Two Steps:
1. Scan the transaction DB for the first time, find frequent
items (single item patterns) and order them into a list L in
frequency descending order.
e.g., L={f:4, c:4, a:3, b:3, m:3, p:3}
In the format of (item-name, support)
2. For each transaction, order its frequent items according to
the order in L; Scan DB the second time, construct FP-tree
by putting each frequency ordered transaction onto it.
8
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
Step 2: scan the DB for the second time, order frequent items
in each transaction
10
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
{} {}
f:1 f:2
{f, c, a, m, p} {f, c, a, b, m}
{} c:1 c:2
a:1 a:2
11
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
{} {} {}
12
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
Construction Example
Final FP-tree
{}
Header Table
f:4 c:1
Item head
f
c c:3 b:1 b:1
a
b a:3 p:1
m
p m:2 b:1
p:2 m:1
13
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
FP-Tree Definition
• FP-tree is a frequent pattern tree . Formally, FP-tree is a tree structure
defined below:
1. One root labeled as “null", a set of item prefix sub-trees as the
children of the root, and a frequent-item header table.
2. Each node in the item prefix sub-trees has three fields:
– item-name : register which item this node represents,
– count, the number of transactions represented by the portion of the path
reaching this node,
– node-link that links to the next node in the FP-tree carrying the same
item-name, or null if there is none.
3. Each entry in the frequent-item header table has two fields,
– item-name, and
– head of node-link that points to the first node in the FP-tree carrying the
item-name.
14
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
• Completeness:
– the FP-tree contains all the information related to mining frequent
patterns (given the min-support threshold). Why?
• Compactness:
– The size of the tree is bounded by the occurrences of frequent items
– The height of the tree is bounded by the maximum number of items in a
transaction
15
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
Questions?
• Why descending order?
• Example 1: {}
f:1 a:1
m:1 p:1
p:1 m:1
16
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-tree
Questions?
• Example 2: {}
TID (ascended) frequent items
100 {p, m, a, c, f} p:3 m:2 c:1
200 {m, b, a, c, f}
300 {b, f} m:2 b:1 b:1 b:1
400 {p, b, c}
500 {p, m, a, c, f} a:2 p:1
c:1 a:2
17
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-Growth
FP-growth:
Mining Frequent Patterns
Using FP-tree
19
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-Growth
3 Major Steps
20
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-Growth: An Example
Properties of FP-Tree
• Node-link property
– For any frequent item ai, all the possible frequent patterns that contain
ai can be obtained by following ai's node-links, starting from ai's head
in the FP-tree header.
• Prefix path property
– To calculate the frequent patterns for a node ai in a path P, only the
prefix sub-path of ai in P need to be accumulated, and its frequency
count should carry the same count as node ai.
22
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-Growth: An Example
23
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-Growth
Step 3: Recursively mine the conditional FP-
tree
conditional FP-tree of conditional FP-tree of conditional FP-tree of
“m”: (fca:3) “am”: (fc:3) add “cam”: (f:3)
{} “c” {}
{} add Frequent Pattern Frequent Pattern
Frequent Pattern “a” f:3 f:3
f:3 add c:3 add add
“c” “f” “f”
c:3
conditional FP-tree of conditional FP-tree of
a:3 “cm”: (f:3) of “fam”: 3
add
{} “f”
Frequent Pattern
Frequent Pattern
add conditional FP-tree of
f:3 “fcm”: 3
“f”
Principles of FP-Growth
25
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
FP-Growth
Conditional Pattern Bases and
Conditional FP-Tree
27
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Summary of FP-Growth Algorithm
• Mining frequent patterns can be viewed as first mining
1-itemset and progressively growing each 1-itemset by
mining on its conditional pattern base recursively
Efficiency Analysis
Facts: usually
1. FP-tree is much smaller than the size of the DB
2. Pattern base is smaller than original FP-tree
3. Conditional FP-tree is smaller than pattern base
mining process works on a set of usually much
smaller pattern bases and conditional FP-trees
Divide-and-conquer and dramatic scale of shrinking
29
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Experiments:
Performance Evaluation
Experiment Setup
• Compare the runtime of FP-growth with classical Apriori and recent
TreeProjection
– Runtime vs. min_sup
– Runtime per itemset vs. min_sup
– Runtime vs. size of the DB (# of transactions)
• Synthetic data sets : frequent itemsets grows exponentially as
minisup goes down
– D1: T25.I10.D10K
• 1K items
• avg(transaction size)=25
• avg(max/potential frequent item size)=10
• 10K transactions
– D2: T25.I20.D100K
• 10k items
31
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Experiments
32
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Experiments
33
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Experiments
Scalability: runtime vs. # of Trans.
(w/ Apriori)
35
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Experiments
Scalability: runtime vs. # of Trans.
(w/ TreeProjection)
Support = 1%
36
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Discussions:
Improve the performance
and scalability of FP-growth
Performance Improvement
38
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Conclusion Remarks
• FP-tree: a novel data structure storing compressed,
crucial information about frequent patterns,
compact yet complete for frequent pattern mining.
39
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Some Notes
• In association analysis, there are two main steps,
find complete frequent patterns is the first step,
though more important step;
41
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Exams Questions
• Q1: What are the main drawback s of Apriori –like approaches and
explain why ?
• A:
• The main disadvantages of Apriori-like approaches are:
1. It is costly to generate those candidate sets;
2. It incurs multiple scan of the database.
The reason is that: Apriori is based on the following heuristic/down-closure
property:
if any length k patterns is not frequent in the database, any length (k+1)
super-pattern can never be frequent.
The two steps in Apriori are candidate generation and test. If the 1-itemsets is
huge in the database, then the generation for successive item-sets would be
quite costly and thus the test.
42
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Exams Questions
• Q2: What is FP-Tree?
• Previous answer: A FP-Tree is a tree data structure that represents the
database in a compact way. It is constructed by mapping each frequency
ordered transaction onto a path in the FP-Tree.
• My Answer: A FP-Tree is an extended prefix tree structure that represents
the transaction database in a compact and complete way. Only frequent
length-1 items will have nodes in the tree, and the tree nodes are arranged
in such a way that more frequently occurring nodes will have better
chances of sharing nodes than less frequently occurring ones. Each
transaction in the database is mapped to one path in the FP-Tree.
43
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)
Exams Questions
• Q3: What is the most significant advantage of FP-Tree? Why FP-Tree is
complete in relevance to frequent pattern mining?
• A: Efficiency, the most significant advantage of the FP-tree is that it
requires two scans to the underlying database (and only two scans) to
construct the FP-tree. This efficiency is further apparent in database with
prolific and long patterns or for mining frequent patterns with low support
threshold.
• As each transaction in the database is mapped to one path in the FP-Tree,
therefore, the frequent item-set information in each transaction is
completely stored in the FP-Tree. Besides, one path in the FP-Tree may
represent frequent item-sets in multiple transactions without ambiguity
since the path representing every transaction must start from the root of
each item prefix sub-tree.
44
Mining Frequent Patterns without Candidate Generation (SIGMOD2000)