PrefixSpan The Presentation (1) Removed
PrefixSpan The Presentation (1) Removed
26
Example
This is the input:
Sequence database
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
27
Step 1
PrefixSpan first counts the support of each item by scanning the
database:
Sequence database
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
28
Step 1
PrefixSpan first counts the support of each item by scanning the
database:
Sequence database
Result:
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
⟨ 𝑎 ⟩ support : 3
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩ ⟨ 𝑏 ⟩ support : 4
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩ ⟨ 𝑐 ⟩ support : 4
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩ ⟨ 𝑑 ⟩ support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
29
Step 2
PrefixSpan eliminates infrequent items:
Sequence database
Result:
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
⟨ 𝑎 ⟩ support : 3
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩ ⟨ 𝑏 ⟩ support : 4
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩ ⟨ 𝑐 ⟩ support : 4
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩ ⟨ 𝑑 ⟩ support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
30
Step 2
PrefixSpan eliminates infrequent items:
Sequence database
Result:
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
⟨ 𝑎 ⟩ support : 3
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩ ⟨ 𝑏 ⟩ support : 4
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩ ⟨ 𝑐 ⟩ support : 4
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
31
Step 2
PrefixSpan eliminates infrequent items:
Sequence database
Result:
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
⟨ 𝑎 ⟩ support : 3
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩ ⟨ 𝑏 ⟩ support : 4
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩ ⟨ 𝑐 ⟩ support : 4
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩
Those are the sequential
patterns containing one item!
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
32
Step 2
PrefixSpan eliminates infrequent items:
Sequence database
Result:
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
⟨ 𝑎 ⟩ support : 3
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩ ⟨ 𝑏 ⟩ support : 4
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩ ⟨ 𝑐 ⟩ support : 4
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩
Those are the sequential
patterns containing one item!
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
Prefixspan then extends each
item recursively…
Lets start with ⟨ 𝑎 ⟩ →
33
Step 3 – Find patterns starting with ⟨ 𝑎 ⟩
Sequence database
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
34
Step 3 – Find patterns starting with ⟨ 𝑎 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
39
Step 3 – Find patterns starting with ⟨ 𝑎 ⟩
40
Step 3 – Find patterns starting with ⟨ 𝑎 ⟩
Projected database of ⟨ 𝑎 ⟩
𝑆1 = ⟨ _𝑏 , 𝑐 , 𝑎 ⟩
𝑆2 = ⟨ _𝑏 , 𝑏 , 𝑐 ⟩
𝑆4 = ⟨ _𝑏 , {𝑐}⟩
Result:
⟨ 𝑎 , {𝑎}⟩ support : 1
⟨ 𝑎 , {𝑏}⟩ support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3 ⟨ 𝑎 , {𝑐}⟩ support: 3
𝑎, 𝑏 support : 3
41
Step 3 – Find patterns starting with ⟨ 𝑎 ⟩
Projected database of ⟨ 𝑎 ⟩
𝑆1 = ⟨ _𝑏 , 𝑐 , 𝑎 ⟩
𝑆2 = ⟨ _𝑏 , 𝑏 , 𝑐 ⟩
𝑆4 = ⟨ _𝑏 , {𝑐}⟩
Result:
42
Step 3 – Find patterns starting with ⟨ 𝑎 ⟩
Projected database of ⟨ 𝑎 ⟩
𝑆1 = ⟨ _𝑏 , 𝑐 , 𝑎 ⟩
𝑆2 = ⟨ _𝑏 , 𝑏 , 𝑐 ⟩
𝑆4 = ⟨ _𝑏 , {𝑐}⟩
Result:
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
44
Step 4 – Find patterns starting with ⟨ 𝑎 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
45
Step 4 – Find patterns starting with ⟨ 𝑎 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
46
Step 4 – Find patterns starting with ⟨ 𝑎 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
47
Step 4 – Find patterns starting with ⟨ 𝑎 , {𝑐}⟩
Result:
⟨ 𝑎 , 𝑐 , {𝑎}⟩ support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
48
Step 4 – Find patterns starting with ⟨ 𝑎 , {𝑐}⟩
Result:
⟨ 𝑎 , 𝑐 , {𝑎}⟩ support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
This pattern is infrequent!
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
50
Step 5 – Find patterns starting with ⟨ 𝑎, 𝑏 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
51
Step 5 – Find patterns starting with ⟨ 𝑎, 𝑏 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
52
Step 5 – Find patterns starting with ⟨ 𝑎, 𝑏 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
53
Step 5 – Find patterns starting with ⟨ 𝑎, 𝑏 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
54
Step 5 – Find patterns starting with ⟨ 𝑎, 𝑏 ⟩
Result:
⟨ 𝑎, 𝑏 , {𝑐}⟩ support : 3
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
⟨ 𝑎, 𝑏 , {𝑎}⟩ support : 1
⟨ 𝑎, 𝑏 , {𝑏}⟩ support : 1
55
Step 5 – Find patterns starting with ⟨ 𝑎, 𝑏 ⟩
Result:
⟨ 𝑎, 𝑏 , {𝑐}⟩ support : 3
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
⟨ 𝑎, 𝑏 , {𝑎}⟩ support : 1
⟨ 𝑎, 𝑏 , {𝑏}⟩ support : 1
56
Step 5 – Find patterns starting with ⟨ 𝑎, 𝑏 ⟩
Result:
⟨ 𝑎, 𝑏 , {𝑐}⟩ support : 3
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
58
Step 6 – Find patterns starting with 𝑎, 𝑏 , {𝑐}
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
59
Step 6 – Find patterns starting with 𝑎, 𝑏 , {𝑐}
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
60
Step 6 – Find patterns starting with 𝑎, 𝑏 , {𝑐}
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
61
Step 6 – Find patterns starting with 𝑎, 𝑏 , {𝑐}
Result:
⟨ 𝑎, 𝑏 , 𝑐 , {𝑎}⟩ support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
62
Step 6 – Find patterns starting with 𝑎, 𝑏 , {𝑐}
Result:
⟨ 𝑎, 𝑏 , 𝑐 , {𝑎}⟩ support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
Sequence database
𝑆1 = ⟨ 𝑎, 𝑏 , 𝑐 , 𝑎 ⟩
𝑆2 = ⟨ 𝑎, 𝑏 , 𝑏 , 𝑐 ⟩
𝑆3 = ⟨ 𝑏 , 𝑐 , {𝑑}⟩
𝑆4 = ⟨ 𝑏 , 𝑎, 𝑏 , {𝑐}⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
64
Step 7 – Find patterns starting with {𝑏}
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
65
Step 7 – Find patterns starting with {𝑏}
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
66
Step 7 – Find patterns starting with {𝑏}
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
67
Step 7 – Find patterns starting with {𝑏}
Result:
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
⟨ 𝑏 , {𝑎}⟩ support : 2
⟨ 𝑏 , {𝑏}⟩ support : 2
⟨ 𝑏 , {𝑐}⟩ support : 3
⟨ 𝑏 , {𝑑}⟩ support : 1
68
Step 7 – Find patterns starting with {𝑏}
Result:
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
⟨ 𝑏 , {𝑎}⟩ support : 2
⟨ 𝑏 , {𝑏}⟩ support : 2
⟨ 𝑏 , {𝑐}⟩ support : 3
⟨ 𝑏 , {𝑑}⟩ support : 1
Then, PrefixSpan tries to find patterns starting 69
with ⟨ 𝑏 , {𝑐}⟩ →
Step 8 – Find patterns starting with ⟨ 𝑏}, {𝑐 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
70
Step 8 – Find patterns starting with ⟨ 𝑏}, {𝑐 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
71
Step 8 – Find patterns starting with ⟨ 𝑏}, {𝑐 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
72
Step 8 – Find patterns starting with ⟨ 𝑏}, {𝑐 ⟩
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
73
Step 8 – Find patterns starting with ⟨ 𝑏}, {𝑐 ⟩
Result:
⟨ 𝑏 , 𝑐 , {𝑎}⟩ support : 1
𝑏 , 𝑐 , {𝑑} support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3
74
Step 8 – Find patterns starting with ⟨ 𝑏}, {𝑐 ⟩
Result:
⟨ 𝑏 , 𝑐 , {𝑎}⟩ support : 1
𝑏 , 𝑐 , {𝑑} support : 1
𝑚𝑖𝑛𝑠𝑢𝑝 = 3