6 Association Rule Mining

Data Warehousing and Data Mining Ā· Unit 6

Association Rule Mining

Exam-focused notes for Association Rule Mining (Data Warehousing and Data Mining, BIT454): what the TU syllabus asks and how it has actually been tested, with 2 solved past questions from this unit.

Association Rule Mining in short

Association rule mining finds items that often occur together in a data set. Shops use it to place products, plan offers and recommend items.

Association Rule Mining: notes

Market basket analysis concept

Market basket analysis studies what customers buy together in one visit. Each visit is a transaction, which is a set of items. The result is a rule such as:

$${bread} \Rightarrow {butter}\quad [support = 20%,\ confidence = 80%]$$

Uses: shelf layout, cross-selling, bundle offers, catalog design and targeted promotions. The same idea works for web pages visited together or symptoms seen together.

Support and confidence measures

Let $N$ be the number of transactions. For a rule $A \Rightarrow B$:

$$support(A \Rightarrow B) = \frac{count(A \cup B)}{N}, \qquad confidence(A \Rightarrow B) = \frac{count(A \cup B)}{count(A)}$$

  • Support shows how common the rule is.
  • Confidence shows how reliable the rule is.
  • An itemset is a set of items. A k-itemset has $k$ items.
  • A frequent itemset has support at least the minimum support threshold.

Frequent itemset generation

Finding frequent itemsets is the costly part. With $d$ items there are $2^d - 1$ possible itemsets, so we must avoid checking all. The key helper is the Apriori property: every subset of a frequent itemset must also be frequent. In other words, if an itemset is infrequent, all its supersets are infrequent too, and can be skipped.

What this unit covers

  • Market basket analysis concept
  • Frequent itemset generation
  • Apriori algorithm
  • Strong association rules
  • Support and confidence measures
  • Laplace smoothing

Apriori algorithm

2081 Ā· 10 marks

Generate the frequent itemset from the following data using the Apriori algorithm and find the strong association rules. Minimum Support = 60%, Minimum Confidence = 75%.

TIDItems
1{A, C, D}
2{B, C, D}
3{A, B, C, D}
4{B, D}
5{A, B, C, D}

[10]

  • Transactions: - T1: {A, C, D} - T2: {B, C, D} - T3: {A, B, C, D} - T4: {B, D} - T5: {A, B, C, D} - Total transactions $N = 5$ - Minimum Support = 60% → absolute count = $0.60 \times 5 = 3$ - Minimum Confidence = 75% --- Item Count Support Frequent? --------------------------------- A 3 (T1,T3,T...
Open this answer on its own page →

Market basket analysis concept

2082.1 Ā· 10 marks

What is the concept behind market basket analysis?How do you generate frequent item sets using Apriori algorithm? Explain.[4+6]

Show solved answer

Market Basket Analysis and Apriori Algorithm

(a) Concept Behind Market Basket Analysis

Market Basket Analysis is a data mining technique used to discover associations and relationships between items purchased together by customers.

Key Concepts:

1. Purpose:

  • Identifies which products are frequently bought together
  • Discovers customer purchasing patterns and behavior
  • Helps in product placement, cross-selling, and promotional strategies

2. Core Idea:

  • Analyzes transaction data to find item combinations
  • Determines how often certain items co-occur in transactions
  • Establishes rules like "if customer buys X, they likely buy Y"

3. Business Applications:

  • Supermarket shelf arrangement (placing related items near each other)
  • Recommendation systems (suggesting complementary products)
  • Bundle pricing and promotional campaigns
  • Inventory management and stock optimization

4. Association Rules:

  • Expressed as: If {Item A} then {Item B}
  • Measured using metrics like support, confidence, and lift
  • Helps predict customer behavior and increase sales

(b) Generating Frequent Itemsets Using Apriori Algorithm

Algorithm Overview:

The Apriori Algorithm generates frequent itemsets by iteratively finding itemsets that appear in at least a minimum support threshold of transactions.

Key Principle:

"If an itemset is frequent, then all of its subsets must also be frequent" (Apriori property)

Steps:

Step 1: Set Minimum Support Threshold

  • Define minimum support (e.g., 50% or 2 transactions out of 4)
  • Only itemsets meeting this threshold are considered frequent

Step 2: Generate 1-Itemsets (L₁)

  • Count occurrences of each individual item
  • Keep items with support ≄ minimum support
  • Example: {A}, {B}, {C}, {D}

Step 3: Generate Candidate k-Itemsets (Cā‚–)

  • Join frequent (k-1)-itemsets to create candidate k-itemsets
  • Apply pruning: remove candidates containing infrequent subsets
  • Example: From {A}, {B}, {C} → candidates {A,B}, {A,C}, {B,C}

Step 4: Count Support for Candidates

  • Scan database to count occurrences of each candidate itemset
  • Calculate support = (frequency of itemset) / (total transactions)

Step 5: Filter by Minimum Support

  • Keep only candidates with support ≄ threshold
  • These become frequent k-itemsets (Lā‚–)

Step 6: Repeat Until No New Itemsets

  • Continue with k+1 until no new frequent itemsets are generated

Example:

TransactionItems
T1{A, B, C}
T2{A, B}
T3{A, C}
T4{B, C}

With minimum support = 50% (2 transactions):

  • L₁: {A}(3), {B}(3), {C}(3) - all frequent
  • Cā‚‚: {A,B}, {A,C}, {B,C}
  • Lā‚‚: {A,B}(2), {A,C}(2), {B,C}(2) - all frequent
  • Cā‚ƒ: {A,B,C}
  • Lā‚ƒ: {A,B,C}(1) - NOT frequent (support < 50%)

Result: Frequent itemsets are {A}, {B}, {C}, {A,B}, {A,C}, {B,C}

Advantages:

  • Efficient pruning reduces search space
  • Guarantees finding all frequent itemsets
  • Widely used in practice
Open this answer on its own page →