---
title: "Apriori on 8 transactions, 25% support"
subject: "Data Mining"
chapter: 4
key: "semester_7/data_mining:apriori-b65-transactions"
source: https://www.bctengineer.com/q/semester_7/data_mining/apriori-b65-transactions
site: BCT Engineering
---

# Apriori on 8 transactions, 25% support

Data Mining · Chapter 4: Association Analysis

- Asked in: 2065 Baisakh
- Video: [3. Apriori Algorithm | Association Rule Mining | Frequent Item Sets Solved Example by Mahesh Huddar](https://www.youtube.com/watch?v=wpCeFC8-z-k) — 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-b65-transactions
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-4

## Question

Write the Apriori Algorithm. Use this algorithm to find the frequent item set and generate few rules associated with the transaction. (Take minimum support=25%, minimum confidence% [value not printed in the paper])

| Transaction ID | Items |
| --- | --- |
| 1 | A, C, D |
| 2 | C, D, E |
| 3 | A, D, E |
| 4 | B, D, E |
| 5 | A, C, D, E |
| 6 | A, D, E |
| 7 | A, B, C |
| 8 | C, E |

## Short answer

With min support 2 (25%) and assumed min confidence 60%, frequent itemsets: A,B,C,D,E; AC,AD,AE,CD,CE,DE; ACD,ADE,CDE. Strong rules include A,E→D (100%), D→E (83.3%), E→D (83.3%), A→D (80%), A,D→E (75%), D→A (66.7%).

## Answer

#### Apriori algorithm
```text
L1 = frequent items (scan database)
for k = 2 while L(k-1) is not empty:
    Ck = join(L(k-1)) and prune candidates with an infrequent subset
    scan database, count candidates
    Lk = candidates with support >= min_support
output all Lk; then generate rules with confidence >= min_conf
```
Principle: every subset of a frequent itemset must be frequent.

#### Solution
8 transactions, minimum support 25% → 0.25 × 8 = **2 transactions**. The minimum confidence is not given, so **60% is assumed**.

**C₁ → L₁**: A 5, B 2, C 5, D 6, E 6. All items have count ≥ 2, so L₁ = {A, B, C, D, E}.

**C₂** counts: AB 1, AC 3, AD 4, AE 3, BC 1, BD 1, BE 1, CD 3, CE 3, DE 5.
**L₂** = {AC:3, AD:4, AE:3, CD:3, CE:3, DE:5} (AB, BC, BD, BE removed, so B appears in no larger itemset).

**C₃** by joining L₂: ACD, ACE, ADE, CDE (others like ADC are the same). All 2-subsets are frequent (no pruning). Counts: ACD 2, ACE 1, ADE 3, CDE 2.
**L₃** = {ACD:2, ADE:3, CDE:2}.

**C₄**: ACDE would need ACE, which is infrequent, so it is pruned. Stop.

**Frequent itemsets**: A, B, C, D, E; AC, AD, AE, CD, CE, DE; ACD, ADE, CDE.

#### Rules from {A, D, E} (support 3)
| Rule | Confidence | Strong (≥ 60%)? |
| --- | --- | --- |
| A, E → D | 3/3 = 100% | Yes |
| A, D → E | 3/4 = 75% | Yes |
| D, E → A | 3/5 = 60% | Yes |
| A → D, E | 3/5 = 60% | Yes |
| D → A, E | 3/6 = 50% | No |
| E → A, D | 3/6 = 50% | No |

#### Rules from some 2-itemsets
D → E 5/6 = 83.3%; E → D 5/6 = 83.3%; A → D 4/5 = 80%; D → A 4/6 = 66.7%; A → C 3/5 = 60%.

#### Rules from {A, C, D} and {C, D, E} (support 2)
A, C → D 2/3 = 66.7%; C, D → A 66.7%; C, D → E 66.7%; C, E → D 66.7%; the others (A, D → C 50%, D, E → C 40%, etc.) are weak.

**Answer: frequent itemsets are listed above (largest {A, D, E}, {A, C, D}, {C, D, E}). Strong rules (confidence ≥ 60%) include A,E → D (100%), D → E (83.3%), E → D (83.3%), A → D (80%), A,D → E (75%), D → A (66.7%).**

## Check yourself

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

1. Minimum support 25% of 8 transactions is:
   A. 2 transactions
   B. 3 transactions
   C. 4 transactions
   D. 1 transaction
   Answer: A. 0.25 x 8 = 2. (Key point: Min count)

2. Why is ACDE pruned?
   A. ACE is infrequent
   B. ACD is infrequent
   C. Its count is 0
   D. It has too many items
   Answer: A. A subset ACE (count 1) is infrequent. (Key point: Pruning ACDE)

3. Confidence of A,E -> D (support of AED 3, AE 3)?
   A. 100%
   B. 75%
   C. 60%
   D. 50%
   Answer: A. 3/3. (Key point: Rule confidence)

4. Why does B not appear in larger itemsets?
   A. B has support 0
   B. All pairs with B are infrequent
   C. B appears in every transaction
   D. B is the only item
   Answer: B. AB, BC, BD, BE each have count 1. (Key point: Why B drops)

## Related in Data Mining

- [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 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 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
- [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
- [FP-Growth and Apriori disadvantage](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Afp-growth-vs-apriori) — Data Mining, chapter 4

## Related in other subjects

- [JFET ID and VDS (IDSS 10 mA, VP -4 V, 25 V)](https://www.bctengineer.com/question.md?key=semester_3%2Felectronics_devices_and_circuit%3Ajfet-divider-bias-idss10-vp4) — Electronics Devices and Circuit, chapter 3, asked 2×
- [Coordination with residual voltage 200 Id^0.25 (PR 1.2)](https://www.bctengineer.com/question.md?key=semester_8%2Fhigh_voltage_engineering%3Aarrester-24ka-pr-1-2) — High Voltage Engineering, chapter 4, asked 2×
- [Coordination with residual voltage 200 Id^0.25 (PR 1.25)](https://www.bctengineer.com/question.md?key=semester_8%2Fhigh_voltage_engineering%3Aarrester-24ka-pr-1-25) — High Voltage Engineering, chapter 4, asked 2×
- [Algorithm for numbers divisible by 9 not 6](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aalgo-flowchart-divisible-9-not-6) — Computer Programming, chapter 2
