Professional Documents
Culture Documents
Data Mining 1
1
Mining Frequent Patterns Without
Candidate Generation
Data Mining 3
2
Benefits of the FP-tree Structure
Completeness:
never breaks a long pattern of any transaction
Data Mining 5
FP-tree
Method
For each item, construct its conditional pattern-
FP-tree
Until the resulting FP-tree is empty, or it contains
only one path (single path will generate all the combinations of
its sub-paths, each of which is a frequent pattern)
Data Mining 6
3
Step 1: From FP-tree to Conditional
Pattern Base
Header Table {}
Item frequency head Conditional pattern bases
f:4 c:1
f 4 item cond. pattern base
c 4
c:3 b:1 b:1 c f:3
a 3
b 3 a fc: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:2 m:1 p fcam:2, cb:1
Data Mining 7
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.
Data Mining 8
4
Step 2: Construct Conditional FP-tree
Data Mining 10
5
Data Mining 15
Data Mining 16
6
Sequence Databases and
Sequential Pattern Analysis
Data Mining 17
7
Challenges on Sequential Pattern
Mining
A huge number of possible sequential patterns
are hidden in databases
A mining algorithm should
find the complete set of patterns, when possible,
satisfying the minimum support (frequency)
threshold
be highly efficient, scalable, involving only a small
number of database scans
be able to incorporate various kinds of user-specific
constraints
Data Mining 19
Data Mining 20
8
GSP—A Generalized Sequential
Pattern Mining Algorithm
Data Mining 21
9
Generating Length-2 Candidates
Data Mining 25
10
The GSP Mining Process
4th scan: 8 cand. 6 length-4 seq. <abba> <(bd)bc> … Cand. not in DB at all
pat.
3rd scan: 46 cand. 19 length-3 seq. <abb> <aab> <aba> <baa> <bab> …
pat. 20 cand. not in DB at all
2nd scan: 51 cand. 19 length-2 seq.
pat. 10 cand. not in DB at all <aa> <ab> … <af> <ba> <bb> … <ff> <(ab)> … <(ef)>
1st scan: 8 cand. 6 length-1 seq.
pat. <a> <b> <c> <d> <e> <f> <g> <h>
Seq. ID Sequence
10 <(bd)cb(ac)>
min_sup =2
20 <(bf)(ce)b(fg)>
30 <(ah)(bf)abf>
40 <(be)(ce)d>
50 <a(bd)bcb(ade)>
26
Bottlenecks of GSP
Data Mining 28
11
PrefixSpan Algorithm
<a> <(abc)(ac)d(cf)>
<aa> <(_bc)(ac)d(cf)>
<ab> <(_c)(ac)d(cf)>
Data Mining 29
Data Mining 30
12
Finding Seq. Patterns with Prefix
<a>
Completeness of PrefixSpan
SDB
SID sequence
Length-1 sequential patterns
10 <a(abc)(ac)d(cf)> <a>, <b>, <c>, <d>, <e>, <f>
20 <(ad)c(bc)(ae)>
30 <(ef)(ab)(df)cb>
40 <eg(af)cbc>
Having prefix <a> Having prefix <c>, …, <f>
Having prefix <b>
<a>-projected database <b>-projected database
<(abc)(ac)d(cf)> Length-2 sequential
…
<(_d)c(bc)(ae)> patterns
<(_b)(df)cb> <aa>, <ab>, <(ab)>,
<(_f)cbc> <ac>, <ad>, <af>
……
Having prefix <aa> Having prefix <af>
<aa>-proj. db … <af>-proj. db
Data Mining 32
13
Efficiency of PrefixSpan
Data Mining 33
Example
10 <a(abc)(ac)d(cf)> <a(abc)(ac)d(cf)>
20 <(ad)c(bc)(ae)> <(ad)c(bc)(ae)>
30 <(ef)(ab)(df)cb> <(ef)(ab)(df)cb>
40 <eg(af)cbc> <eg(af)cbc>
Prefix Projected(suffix) databases Sequential Patterns
Data Mining
14
Sequence_id Sequence
10 <a(abc)(ac)d(cf)>
Example 20 <(ad)c(bc)(ae)>
30 <(ef)(ab)(df)cb>
40 <eg(af)cbc>
Data Mining 35
Data Mining 36
15
Prefix Projected(suffix) databases Sequential Patterns
PrefixSpan Algorithm
Main Idea: Use frequent prefixes to divide the search space and to
project sequence databases. only search the relevant sequences.
PrefixSpan(, i, S|)
1. Scan S| once, find the set of frequent items b such that
• b can be assembled to the last element of to form a
sequential pattern; or
• <b> can be appended to to form a sequential pattern.
2. For each frequent item b, appended it to to form a sequential
pattern ’, and output ’;
3. For each ’, construct ’-projected database S|’, and call
PrefixSpan(’, i+1,S|’).
Data Mining 38
16