---
title: "Apriori on four transactions, support 2"
subject: "Data Mining"
chapter: 4
key: "semester_7/data_mining:apriori-y63-min-support-2"
source: https://www.bctengineer.com/q/semester_7/data_mining/apriori-y63-min-support-2
site: BCT Engineering
---

# Apriori on four transactions, support 2

Data Mining · Chapter 4: Association Analysis

- Asked in: 2063, 2+10 marks
- Video: [#2 Solved Example Apriori Algorithm to find Strong Association Rules Data Mining Machine Learning](https://www.youtube.com/watch?v=zi_ydmbWfAs) — Mahesh Huddar
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/data_mining/apriori-y63-min-support-2
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-4

## Question

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 |

## 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.

## Answer

#### Apriori algorithm
```text
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}.**

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which item is dropped from L1?
   A. D, count 1
   B. A, count 2
   C. B, count 3
   D. E, count 3
   Answer: A. Only D has count below 2. (Key point: L1)

2. Which pairs are in L2?
   A. AB, AE, BC, CE
   B. AC, BC, BE, CE
   C. AC, AD, BE, CE
   D. All six pairs
   Answer: B. AB and AE have count 1. (Key point: L2)

3. What is L3 and its count?
   A. {A,B,C} with count 2
   B. {A,C,E} with count 1
   C. {B,C,E} with count 2
   D. Empty
   Answer: C. BCE appears in transactions 20 and 30. (Key point: L3)

4. Why is {A,B,C} pruned?
   A. It contains D
   B. Its count exceeds minsup
   C. C is infrequent
   D. It contains infrequent AB
   Answer: D. Any infrequent subset removes the candidate. (Key point: Pruned candidate)

## Related in Data Mining

- [Apriori on 8 transactions, 25% support](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-b65-transactions) — Data Mining, chapter 4
- [Apriori on t1-t5 with rules](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-t1-t5-rules) — Data Mining, chapter 4
- [Apriori on restaurant orders](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-restaurant) — Data Mining, chapter 4
- [Apriori on HotDogs data with rules](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-hotdogs-rules) — Data Mining, chapter 4

## Related in other subjects

- [AVL tree for 10 20 30 50 45 40 8 5 3](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Aavl-build-10-20-30) — Data Structure and Algorithm, chapter 6
- [RCC slab culvert 1.5 m span: four items](https://www.bctengineer.com/question.md?key=semester_7%2Festimating_and_costing%3Aslab-culvert-n-four-items) — Estimating and Costing, chapter 6
- [AVL tree for 10, 20, 30, 35, 50, ...](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Aavl-build-10-20-30-35) — Data Structure and Algorithm, chapter 6
- [Bresenham: line (20,10) to (30,18)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Adigitize-line-20-10-30-18) — Computer Graphics, chapter 2, asked 4×
