- 2063 · 2+10 marks
Apriori on four transactions, support 2
Short answer
Apriori algorithm finds frequent itemsets level-wise. For min support 2, L1={A,B,C,E}, L2={AC,BC,BE,CE}, L3={BCE}. Candidate sets: C1 (all items), C2 (pairs from L1), C3={BCE} after pruning. Final frequent itemsets: A,B,C,E, AC,BC,BE,CE, BCE.
Write the Apriori algorithm. Identify the candidate and large item sets of the following transaction table. Use Apriori algorithm with minimum support 2.
| TID | Items |
|---|---|
| 10 | A, C, D |
| 20 | B, C, E |
| 30 | A, B, C, E |
| 40 | B, E |
Apriori algorithm
L1 = {frequent 1-itemsets}
for k = 2 while L(k-1) is not empty:
Ck = candidates from joining L(k-1) with itself
(prune those having an infrequent (k-1)-subset)
count Ck in the database; Lk = {c in Ck : count(c) >= min_sup}
return union of Lk
Candidate sets (C) are the itemsets generated at each level; large (frequent) sets (L) are those that meet the minimum support.
Solution (minimum support count = 2)
Transactions: 10: A C D; 20: B C E; 30: A B C E; 40: B E.
Scan 1: C₁
| Itemset | Count | In L₁? |
|---|---|---|
| A | 2 | Yes |
| B | 3 | Yes |
| C | 3 | Yes |
| D | 1 | No |
| E | 3 | Yes |
L₁ = {A, B, C, E}
Scan 2: C₂ (all pairs from L₁)
| Itemset | Count | In L₂? |
|---|---|---|
| AB | 1 | No |
| AC | 2 | Yes |
| AE | 1 | No |
| BC | 2 | Yes |
| BE | 3 | Yes |
| CE | 2 | Yes |
L₂ = {AC, BC, BE, CE}
C₃: join L₂ itemsets that share the first item: BC and BE give {B, C, E}. Prune check: its subsets BC, BE and CE are all in L₂, so it stays. (Other 3-itemsets such as {A, B, C} and {A, C, E} are not produced by the join, and they would be pruned anyway because they contain the infrequent AB or AE.)
Scan 3: count(BCE) = 2 (transactions 20 and 30) → L₃ = {B, C, E}.
C₄: no candidate can be formed from a single 3-itemset, so the algorithm stops.
Answer: Candidate sets: C₁, C₂ and C₃ = {BCE}. Large (frequent) itemsets: L₁ = {A, B, C, E}; L₂ = {AC, BC, BE, CE}; L₃ = {BCE}.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Apriori on 8 transactions, 25% support · Data Mining, chapter 4
- Apriori on t1-t5 with rules · Data Mining, chapter 4
- Apriori on restaurant orders · Data Mining, chapter 4
- Apriori on HotDogs data with rules · Data Mining, chapter 4
- AVL tree for 10 20 30 50 45 40 8 5 3 · Data Structure and Algorithm, chapter 6
- RCC slab culvert 1.5 m span: four items · Estimating and Costing, chapter 6
- AVL tree for 10, 20, 30, 35, 50, ... · Data Structure and Algorithm, chapter 6
- Bresenham: line (20,10) to (30,18) · Computer Graphics, chapter 2 · asked 4×