CSC420 · 2081 · 10 marks
How do you generate strong association rules? From the following dataset find the frequent item set using FP growth algorithm using 3 as minimum support. | Transaction ID | Items | |---|---| | T1 | {K, E, M, O, Y} | | T2 | {K, E, O, Y} | | T3 | {K, E, M} | | T4 | {K, M, Y} | | T5 | {K, E, O} |
How do you generate strong association rules? From the following dataset find the frequent item set using FP growth algorithm using 3 as minimum support.
| Transaction ID | Items |
|---|---|
| T1 | {K, E, M, O, Y} |
| T2 | {K, E, O, Y} |
| T3 | {K, E, M} |
| T4 | {K, M, Y} |
| T5 | {K, E, O} |
[10]
Strong Association Rules and FP-Growth
Given Data
Transactions:
- T1: {K, E, M, O, Y}
- T2: {K, E, O, Y}
- T3: {K, E, M}
- T4: {K, M, Y}
- T5: {K, E, O}
Minimum support = 3
Part 1: Generating Strong Association Rules
A strong association rule $X \Rightarrow Y$ satisfies both thresholds:
- $\text{support}(X \cup Y) \geq \text{min_support}$
- $\text{confidence}(X \Rightarrow Y) = \dfrac{\text{support}(X \cup Y)}{\text{support}(X)} \geq \text{min_confidence}$
Procedure:
- Find all frequent itemsets satisfying min support (via Apriori or FP-Growth).
- For each frequent itemset $l$, generate every non-empty proper subset $s$.
- For each such $s$, form the rule $s \Rightarrow (l - s)$ and compute confidence $= \dfrac{\text{support}(l)}{\text{support}(s)}$.
- Output the rule only if confidence $\geq$ min_confidence. These are the strong rules.
Part 2: FP-Growth (min_support = 3)
Step 1: Item frequency (1st scan)
| Item | Count |
|---|---|
| K | 5 |
| E | 4 |
| M | 3 |
| O | 3 |
| Y | 3 |
All satisfy min support. Order (descending, ties alphabetical): K:5, E:4, M:3, O:3, Y:3
Step 2: Reordered transactions
| TID | Ordered |
|---|---|
| T1 | K, E, M, O, Y |
| T2 | K, E, O, Y |
| T3 | K, E, M |
| T4 | K, M, Y |
| T5 | K, E, O |
Step 3: FP-Tree
null
└── K:5
├── E:4
│ ├── M:1
│ │ └── O:1
│ │ └── Y:1
│ └── O:2
│ └── Y:1
└── M:2
└── Y:1
Note on M placement:
- T1 (KEMOY) and T3 (KEM) go under E-branch: E→M appears twice (M:2 under E).
- T4 (KMY) goes under K directly: K→M (M:1 under K, no E).
So M under E has count 2, and M under K (no E) has count 1. Total M = 3. ✓
Corrected FP-Tree:
null
└── K:5
├── E:4
│ ├── M:2 (from T1, T3)
│ │ └── O:1 (T1)
│ │ └── Y:1
│ └── O:2 (T2, T5)
│ └── Y:1 (T2)
└── M:1 (T4)
└── Y:1
Take care with the M counts: the correct placement is M:2 under E and M:1 under K, not the other way round.
Header table:
| Item | Support | Node links |
|---|---|---|
| K | 5 | K:5 |
| E | 4 | E:4 |
| M | 3 | M:2, M:1 |
| O | 3 | O:1, O:2 |
| Y | 3 | Y:1, Y:1, Y:1 |
Step 4: Mining (bottom-up)
Item Y (support 3): Conditional pattern base:
- {K,E,M,O}:1 (T1)
- {K,E,O}:1 (T2)
- {K,M}:1 (T4)
Counts: K=3, E=2, M=2, O=2. Only K:3 ≥ 3. Frequent: {K,Y}:3
Item O (support 3): Conditional pattern base:
- {K,E,M}:1 (T1)
- {K,E}:2 (T2, T5)
Counts: K=3, E=3, M=1. Survive: K:3, E:3. Conditional FP-tree: K→E (3). Frequent: {K,O}:3, {E,O}:3, {K,E,O}:3
Item M (support 3): Conditional pattern base:
- {K,E}:2 (T1, T3)
- {K}:1 (T4)
Counts: K=3, E=2. Only K:3 survives. Frequent: {K,M}:3
Item E (support 4): Conditional pattern base:
- {K}:4
Frequent: {K,E}:4
Item K: root, no conditional patterns.
Final Frequent Itemsets (support ≥ 3)
1-itemsets:
- {K}:5, {E}:4, {M}:3, {O}:3, {Y}:3
2-itemsets:
- {K,E}:4
- {K,M}:3
- {K,O}:3
- {E,O}:3
- {K,Y}:3
3-itemsets:
- {K,E,O}:3
The maximal/most useful frequent itemset is {K, E, O} with support 3.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.