---
title: "Apriori on t1-t5 with rules"
subject: "Data Mining"
chapter: 4
key: "semester_7/data_mining:apriori-t1-t5-rules"
source: https://www.bctengineer.com/q/semester_7/data_mining/apriori-t1-t5-rules
site: BCT Engineering
---

# Apriori on t1-t5 with rules

Data Mining · Chapter 4: Association Analysis

- Asked in: year not given
- 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-t1-t5-rules
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-4

## Question

Identify the candidate and large item sets of the following transaction table. Use Apriori algorithm with minimum support 2. Also, indicate association rules generated, underline the strong ones and sort them by confidence. (min_conf = 60%)

| Transaction id | Items |
| --- | --- |
| t1 | {A, C, D} |
| t2 | {B, C, E} |
| t3 | {A, B, C, E} |
| t4 | {B, E} |
| t5 | {A, B, C, E} |

## Short answer

Apriori with min_sup=2 yields 15 frequent itemsets, largest {A,B,C,E}. 37 strong rules (conf≥60%) include A→C, B→E (100%), B→C (75%), A→B (66.7%), sorted by confidence.

## Answer

Minimum support count = 2, minimum confidence = 60%. Transactions: t1 {A, C, D}; t2 {B, C, E}; t3 {A, B, C, E}; t4 {B, E}; t5 {A, B, C, E}.

#### Frequent itemsets by Apriori
**C₁**: A 3, B 4, C 4, D 1, E 4 → D is removed. **L₁** = {A, B, C, E}.

**C₂ and L₂**
| Itemset | Count | Frequent? |
| --- | --- | --- |
| A, B | 2 | Yes |
| A, C | 3 | Yes |
| A, E | 2 | Yes |
| B, C | 3 | Yes |
| B, E | 4 | Yes |
| C, E | 3 | Yes |

**C₃ and L₃** (all subsets frequent, no pruning)
| Itemset | Count | Frequent? |
| --- | --- | --- |
| A, B, C | 2 | Yes |
| A, B, E | 2 | Yes |
| A, C, E | 2 | Yes |
| B, C, E | 3 | Yes |

**C₄ and L₄**: {A, B, C, E} count 2 → frequent. No C₅.

Total frequent itemsets: 4 + 6 + 4 + 1 = 15.

#### Association rules
Every non-empty proper subset X of each frequent itemset L (size ≥ 2) gives X → L − X with confidence = count(L)/count(X). Rules are sorted by confidence; the **strong** rules (≥ 60%) are in bold.

| Rule | Support count | Confidence | Strong? |
| --- | --- | --- | --- |
| **A → C** | 3 | 3/3 = 100.0% | Yes |
| **B → E** | 4 | 4/4 = 100.0% | Yes |
| **E → B** | 4 | 4/4 = 100.0% | Yes |
| **A, B → C** | 2 | 2/2 = 100.0% | Yes |
| **A, B → C, E** | 2 | 2/2 = 100.0% | Yes |
| **A, B → E** | 2 | 2/2 = 100.0% | Yes |
| **A, E → B** | 2 | 2/2 = 100.0% | Yes |
| **A, E → B, C** | 2 | 2/2 = 100.0% | Yes |
| **A, E → C** | 2 | 2/2 = 100.0% | Yes |
| **B, C → E** | 3 | 3/3 = 100.0% | Yes |
| **C, E → B** | 3 | 3/3 = 100.0% | Yes |
| **A, B, C → E** | 2 | 2/2 = 100.0% | Yes |
| **A, B, E → C** | 2 | 2/2 = 100.0% | Yes |
| **A, C, E → B** | 2 | 2/2 = 100.0% | Yes |
| **B → C** | 3 | 3/4 = 75.0% | Yes |
| **B → C, E** | 3 | 3/4 = 75.0% | Yes |
| **C → A** | 3 | 3/4 = 75.0% | Yes |
| **C → B** | 3 | 3/4 = 75.0% | Yes |
| **C → B, E** | 3 | 3/4 = 75.0% | Yes |
| **C → E** | 3 | 3/4 = 75.0% | Yes |
| **E → B, C** | 3 | 3/4 = 75.0% | Yes |
| **E → C** | 3 | 3/4 = 75.0% | Yes |
| **B, E → C** | 3 | 3/4 = 75.0% | Yes |
| **A → B** | 2 | 2/3 = 66.7% | Yes |
| **A → B, C** | 2 | 2/3 = 66.7% | Yes |
| **A → B, C, E** | 2 | 2/3 = 66.7% | Yes |
| **A → B, E** | 2 | 2/3 = 66.7% | Yes |
| **A → C, E** | 2 | 2/3 = 66.7% | Yes |
| **A → E** | 2 | 2/3 = 66.7% | Yes |
| **A, C → B** | 2 | 2/3 = 66.7% | Yes |
| **A, C → B, E** | 2 | 2/3 = 66.7% | Yes |
| **A, C → E** | 2 | 2/3 = 66.7% | Yes |
| **B, C → A** | 2 | 2/3 = 66.7% | Yes |
| **B, C → A, E** | 2 | 2/3 = 66.7% | Yes |
| **C, E → A** | 2 | 2/3 = 66.7% | Yes |
| **C, E → A, B** | 2 | 2/3 = 66.7% | Yes |
| **B, C, E → A** | 2 | 2/3 = 66.7% | Yes |
| B → A | 2 | 2/4 = 50.0% | No |
| B → A, C | 2 | 2/4 = 50.0% | No |
| B → A, C, E | 2 | 2/4 = 50.0% | No |
| B → A, E | 2 | 2/4 = 50.0% | No |
| C → A, B | 2 | 2/4 = 50.0% | No |
| C → A, B, E | 2 | 2/4 = 50.0% | No |
| C → A, E | 2 | 2/4 = 50.0% | No |
| E → A | 2 | 2/4 = 50.0% | No |
| E → A, B | 2 | 2/4 = 50.0% | No |
| E → A, B, C | 2 | 2/4 = 50.0% | No |
| E → A, C | 2 | 2/4 = 50.0% | No |
| B, E → A | 2 | 2/4 = 50.0% | No |
| B, E → A, C | 2 | 2/4 = 50.0% | No |

**Answer: 15 frequent itemsets (largest {A, B, C, E}). 50 rules are generated (12 from the 2-itemsets, 24 from the 3-itemsets and 14 from the 4-itemset). Of these, 37 are strong (14 at 100%, 9 at 75% and 14 at 66.7%), and the other 13 have confidence 50%.**

## Check yourself

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

1. Which item is removed from L1 and why?
   A. D, since its count is 1 < 2
   B. A, since its count is 3
   C. B, since it appears everywhere
   D. E, since it only appears in t2 and t3
   Answer: A. Only D has count below the minimum support. (Key point: L1)

2. What is the largest frequent itemset?
   A. {B, C, E} with count 3
   B. {A, B, C, E} with count 2
   C. {A, C, D} with count 1
   D. {A, B, C} only
   Answer: B. All four items together appear in t3 and t5. (Key point: Largest itemset)

3. What is confidence of A -> B?
   A. 2/4 = 50%
   B. 100%
   C. 2/3 = 66.7%
   D. 3/4 = 75%
   Answer: C. A appears 3 times; A and B together twice. (Key point: Rule confidence)

4. How are rules generated from a frequent itemset L?
   A. Only single items on the left are used
   B. Only rules with 100% confidence are kept
   C. Rules are generated from infrequent itemsets only
   D. For every non-empty proper subset X give X -> L-X if count(L)/count(X) >= min_conf
   Answer: D. Each subset X gives a candidate rule, tested for confidence. (Key point: Rule generation)

## Related in Data Mining

- [Apriori on HotDogs data with rules](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-hotdogs-rules) — Data Mining, chapter 4
- [Association rules, support, confidence](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aassociation-rule-support-confidence) — Data Mining, chapter 4
- [Apriori on four transactions, support 2](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-y63-min-support-2) — Data Mining, chapter 4
- [Apriori on 8 transactions, 25% support](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-b65-transactions) — Data Mining, chapter 4
- [FP-tree on t1-t5 data](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Afp-tree-t1-t5) — 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
