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

# Apriori on HotDogs data with rules

Data Mining · Chapter 4: Association Analysis

- Asked in: year not given
- Video: [How to use Apriori Algorithm to find the Association Rules Mining Hot Dog Ketchup Coke Chips Mahesh](https://www.youtube.com/watch?v=RDQplhHYUr0) — 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-hotdogs-rules
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-4

## Question

Given min_sup=33.34% and min_conf=60%, use apriori algorithm on following transaction data to determine frequent item sets. Also, indicate association rules generated, underline the strong ones and sort them by confidence.

| Transaction ID | Item set |
| --- | --- |
| TID1 | HotDogs, Buns, Ketchup |
| TID2 | HotDogs, Buns |
| TID3 | HotDogs, Coke, Chips |
| TID4 | Coke, Chips |
| TID5 | Chips, Ketchup |
| TID6 | HotDogs, Coke, Chips |

## Short answer

Apriori with min_sup=2 yields frequent itemsets: all singles, pairs like {HotDogs,Buns}, and triple {HotDogs,Coke,Chips}. Strong rules (conf≥60%) include Buns→HotDogs (100%), Coke→Chips (100%), Chips,HotDogs→Coke (100%), and Coke→HotDogs (66.7%), sorted by confidence.

## Answer

**Assumption**: min_sup = 33.34% of 6 transactions is taken as **2 transactions** (2/6 = 33.3%). min_conf = 60%.

Transactions: TID1 {HotDogs, Buns, Ketchup}; TID2 {HotDogs, Buns}; TID3 {HotDogs, Coke, Chips}; TID4 {Coke, Chips}; TID5 {Chips, Ketchup}; TID6 {HotDogs, Coke, Chips}.

#### Frequent itemsets by Apriori
**C₁ → L₁**: HotDogs 4, Buns 2, Ketchup 2, Coke 3, Chips 4. All have count ≥ 2, so L₁ contains all five.

**C₂** (10 pairs) counts:
| Pair | Count | Frequent? |
| --- | --- | --- |
| HotDogs, Buns | 2 | Yes |
| HotDogs, Ketchup | 1 | No |
| HotDogs, Coke | 2 | Yes |
| HotDogs, Chips | 2 | Yes |
| Buns, Ketchup | 1 | No |
| Buns, Coke | 0 | No |
| Buns, Chips | 0 | No |
| Ketchup, Coke | 0 | No |
| Ketchup, Chips | 1 | No |
| Coke, Chips | 3 | Yes |

**L₂** = {HotDogs-Buns:2, HotDogs-Coke:2, HotDogs-Chips:2, Coke-Chips:3}

**C₃**: HotDogs-Coke + HotDogs-Chips → {HotDogs, Coke, Chips}; its subsets Coke-Chips, HotDogs-Coke, HotDogs-Chips are all frequent. Another join, HotDogs-Buns + HotDogs-Coke → {HotDogs, Buns, Coke}, is pruned (Buns-Coke infrequent), likewise {HotDogs, Buns, Chips}. Count({HotDogs, Coke, Chips}) = 2 (TID3, TID6) → **L₃ = {HotDogs, Coke, Chips}**.

**Frequent itemsets**: 5 single items, the 4 pairs of L₂, and the triple {HotDogs, Coke, Chips}.

#### Association rules (sorted by confidence; strong rules in bold)
| Rule | Support count | Confidence | Strong? |
| --- | --- | --- | --- |
| **Buns → HotDogs** | 2 | 2/2 = 100.0% | Yes |
| **Coke → Chips** | 3 | 3/3 = 100.0% | Yes |
| **Chips, HotDogs → Coke** | 2 | 2/2 = 100.0% | Yes |
| **Coke, HotDogs → Chips** | 2 | 2/2 = 100.0% | Yes |
| **Chips → Coke** | 3 | 3/4 = 75.0% | Yes |
| **Coke → Chips, HotDogs** | 2 | 2/3 = 66.7% | Yes |
| **Coke → HotDogs** | 2 | 2/3 = 66.7% | Yes |
| **Chips, Coke → HotDogs** | 2 | 2/3 = 66.7% | Yes |
| Chips → Coke, HotDogs | 2 | 2/4 = 50.0% | No |
| Chips → HotDogs | 2 | 2/4 = 50.0% | No |
| HotDogs → Buns | 2 | 2/4 = 50.0% | No |
| HotDogs → Chips | 2 | 2/4 = 50.0% | No |
| HotDogs → Chips, Coke | 2 | 2/4 = 50.0% | No |
| HotDogs → Coke | 2 | 2/4 = 50.0% | No |

**Answer: 8 strong rules (confidence ≥ 60%): Buns → HotDogs (100%), Coke → Chips (100%), Chips, HotDogs → Coke (100%), Coke, HotDogs → Chips (100%), Chips → Coke (75%), Chips, Coke → HotDogs (66.7%), Coke → HotDogs (66.7%), Coke → Chips, HotDogs (66.7%).** (The table lists all 14; those below 60% are not strong.)

If the threshold is applied strictly (33.34% needs count > 2), only items HotDogs, Coke, Chips and the pair {Coke, Chips} stay frequent, giving Coke → Chips (100%) and Chips → Coke (75%).

## Check yourself

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

1. What is L3?
   A. {HotDogs, Buns, Coke}
   B. {HotDogs, Coke, Chips} with count 2
   C. {HotDogs, Buns, Chips}
   D. L3 is empty
   Answer: B. HotDogs, Coke, Chips appear together in TID3 and TID6; the Buns candidates are pruned. (Key point: Frequent triple)

2. What is confidence of Chips -> Coke?
   A. 3/3 = 100%
   B. 3/6 = 50%
   C. 3/4 = 75%
   D. 2/4 = 50%
   Answer: C. Coke-Chips has count 3, Chips has 4. (Key point: Confidence)

3. Which rule is NOT strong at min_conf 60%?
   A. Coke -> HotDogs (2/3)
   B. Buns -> HotDogs (2/2)
   C. Chips, Coke -> HotDogs (2/3)
   D. HotDogs -> Coke (2/4 = 50%)
   Answer: D. A rule is strong only if confidence >= 60%. (Key point: Strong rules)

## Related in Data Mining

- [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
- [FP-tree on HotDogs data](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Afp-tree-hotdogs) — 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
- [Association analysis and Apriori pruning](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aassociation-apriori-pruning) — Data Mining, chapter 4, asked 2×
- [Apriori on 8 transactions, 25% support](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aapriori-b65-transactions) — Data Mining, chapter 4
