Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Chapter 6 Tutorial

Q6
A database has 5 transactions. Let min sup = 60% and min conf = 80%.

a) Find all frequent itemsets using Apriori and FB-growth. b) List all of the strong association rules (with support s and confidence c) matching the following metarule, where X is a variable representing customers, and item i denotes variables representing items (e.g., A, B, etc.):

Q6.a
Apriori algorithm

Finally resulting in the complete set of frequent itemsets: { e, k, m, o, y, ke, oe, mk, ok, ky, oke }

Q6.a
FB-Growth algorithm
1. Scan DB once, find frequent 1-itemset (single item pattern) their support => 3
M O 3 3 K E M O Y 5 4 3 3 3

N
K E Y

2
5 4 3

After checking support

D
A U C I

1
1 1 2 1

TID T100 T200 T300 T400 T500

items bought {M, O, N, K, E, Y} {D, O, N, K, E, Y } {M, A, K, E} {M, U, C, K, Y} {C, O, O, K, I ,E}

(ordered) Frequent items K,E,M,O,Y K,E,O,Y K,E,M K, M, Y K,E,O

Q6.a FB-Growth algorithm


Generate FB-tree

Generate FB-tree order table

Q6.b
buys(X,k) buys(X,o) => buys(X, e) [60%,100%]

buys(X,e) buys(X,o) => buys(X, k)

[60%,100%]

Exercise 1

Support( A B) P( A B)
Confidence( A B) P( B A)
support( A B) support_co unt( A B) Confidence( A B) P( B A) support( A) support_co unt( A)

Show an example association rule that matches (a1, a2, a3, a4, itemX) -> (itemY) [min_support = 2, min_confidence=70%]

For association rule a1->a6, compute the confidence confidence = p(a1 a6)/p(a1) = (2/5)/(3/5) = 2/3=0.67

Exercise 2

Activity
a dataset has eight transactions. Let minimum support = 50 %. Find all frequent itemsets using FP-Growth
TID T1 T2 T3 T4 T5 T6 T7 T8 Item bought {W, O, R, N} {W, T, U, G} {X , T, U, G} {S ,N, T, U, G} {B ,R, G, T, D} {T, X, I, L, U} {G, U, R, T, X} {X, O, N, G, T}

You might also like