Back to the 2023 paper

Module 2: Data Mining Fundamentals and Association Rule Mining

20239m

Consider the 5 transactions given below. If minimum support is 30% and minimum confidence is 80% determine the frequent itemsets and association rules using apriori algorithm.

Transaction Items
T1 Bread, Jelly, Butter
T2 Bread, Butter
T3 Bread, Milk, Butter
T4 Coke, Bread
T5 Coke, Milk
Worked SolutionAI Assisted

Q7(b) - Frequent Itemsets and Association Rules by the Apriori Algorithm

Given: 5 transactions, minimum support = 30%, minimum confidence = 80%.

minsup count=30% of 5=0.30×5=1.5 ⇒ an itemset must occur in ≥2 transactionsminsup\ count = 30\% \ \text{of} \ 5 = 0.30 \times 5 = 1.5 \ \Rightarrow \ an\ itemset\ must\ occur\ in\ \ge 2\ transactions

Abbreviations: Bread = B, Butter = Bu, Milk = M, Coke = C, Jelly = J.

TID Items
T1 Bread, Jelly, Butter
T2 Bread, Butter
T3 Bread, Milk, Butter
T4 Coke, Bread
T5 Coke, Milk

Step 1 - Scan 1: 1-itemsets

Itemset Transactions Count Support Frequent?
{Bread} T1, T2, T3, T4 4 4/5 = 80% Yes
{Butter} T1, T2, T3 3 3/5 = 60% Yes
{Milk} T3, T5 2 2/5 = 40% Yes
{Coke} T4, T5 2 2/5 = 40% Yes
{Jelly} T1 1 1/5 = 20% No (< 30%)

L1={{Bread}:4, {Butter}:3, {Milk}:2, {Coke}:2}L_1 = \{\{Bread\}:4,\ \{Butter\}:3,\ \{Milk\}:2,\ \{Coke\}:2\}

Jelly is dropped, so no itemset containing Jelly can ever be frequent (Apriori property / downward closure).

Step 2 - Scan 2: candidate 2-itemsets from L1L_1

Candidate Transactions Count Support Frequent?
{Bread, Butter} T1, T2, T3 3 3/5 = 60% Yes
{Bread, Milk} T3, T4 2 2/5 = 40% Yes
{Bread, Coke} T4 1 1/5 = 20% No
{Butter, Milk} T3 1 1/5 = 20% No
{Butter, Coke} - 0 0% No
{Milk, Coke} T5 1 1/5 = 20% No

L2={{Bread,Butter}:3, {Bread,Milk}:2}L_2 = \{\{Bread, Butter\}:3,\ \{Bread, Milk\}:2\}

Step 3 - Scan 3: 3-itemsets

The only join candidate is {Bread, Butter, Milk}. Its subset {Butter, Milk} is not in L2L_2, so by the Apriori property the candidate is pruned and no scan is required.

L3=∅⇒stopL_3 = \varnothing \quad \Rightarrow \quad \textbf{stop}

All frequent itemsets

Level Frequent itemset Support count Support %
1 {Bread} 4 80%
1 {Butter} 3 60%
1 {Milk} 2 40%
1 {Coke} 2 40%
2 {Bread, Butter} 3 60%
2 {Bread, Milk} 2 40%

Step 4 - Association rules (minimum confidence 80%)

confidence(X⇒Y)=support(X∪Y)support(X)confidence(X \Rightarrow Y) = \frac{support(X \cup Y)}{support(X)}

Rules are generated only from itemsets with two or more items:

Rule Confidence calculation Confidence Passes 80%?
Bread ⇒\Rightarrow Butter 3/4 75% No
Butter ⇒\Rightarrow Bread 3/3 100% Yes
Bread ⇒\Rightarrow Milk 2/4 50% No
Milk ⇒\Rightarrow Bread 2/2 100% Yes

Result

Frequent itemsets: {Bread} 80%, {Butter} 60%, {Milk} 40%, {Coke} 40%, {Bread, Butter} 60%, {Bread, Milk} 40%.

Strong (valid) association rules with support ≥\ge 30% and confidence ≥\ge 80%:

  1. {Butter}⇒{Bread}\{Butter\} \Rightarrow \{Bread\} - support 60%, confidence 100%
  2. {Milk}⇒{Bread}\{Milk\} \Rightarrow \{Bread\} - support 40%, confidence 100%

The other two candidate rules fail the 80% confidence test (75% and 50%), so they are rejected.

Similar questions

Data MiningA database has five transactions. Let min_sup = 60% and min_conf = 80%. | TID | Items_bought | |---|---| | T100 | {M, O, N, K, E, Y} | | T200 | {D, O, N, K, E, Y} | | T300 | {M, A, K, E} | | T400 | {M, U, C, K, Y} | | T500 | {C, O, O, K, I, E} | (i) Find all frequent item sets using a priori algorithm. (ii) List all the strong association rules (with support s and confidence c) matching the following metarule, where X is a variable representing customers: \forall x \in \text{transactions}, \text{buys}(X, \text{item}_1) \wedge \text{buys}(X, \text{item}_2) \Rightarrow \text{buys}(X, \text{item}_3)\ [s, c]20218mData MiningConsider a database D, consisting of 15 transactions. Suppose minimum support count is 2 (i.e., min_sup = 20%) and minimum confidence required is 70%. Find out the frequent item set using a priori algorithm. Explain each step with diagram: | A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |20208mData MiningA database has five transactions. Let min sup = 60% and min con f = 80% : | TID | items_bought | |---|---| | T100 | {M, O, N, K, E, Y} | | T200 | {D, O, N, K, E, Y} | | T300 | {M, A, K, E} | | T400 | {M, U, C, K, Y} | | T500 | {C, O, O, K, I, E} | Find all frequent item sets using Apriori and FP-growth, respectively. Compare the efficiency of the two mining processes.202214mData MiningIn a database of 200 transactions, an itemset occurs in 50 transactions. Its support is (i) 10% (ii) 25% (iii) 20% (iv) 50%20262m
Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.