Association Rule Mining In Machine Learning

 

Association Rule Mining In Machine Learning

1) Introduction

Association Rule Mining is a data-mining technique used to discover relationships between items in large datasets. It answers questions like:

  • “If a customer buys A, what else do they usually buy?”
  • “Which services are commonly used together?”
  • “What combinations of events happen frequently?”

It is most famous in Market Basket Analysis (retail), but it is used in many other domains too.


2) Key Idea (in simple words)

Association rules look like this:

A → B

Meaning:
If A happens, then B also tends to happen (in the same transaction/session/event).

Example:

  • {Bread, Butter} → {Jam}
    Customers who buy bread and butter often also buy jam.

3) When Association Rules are Used

Use association rule mining when:

Your data is transactional (each row is a basket / set / group of items)
You want to find co-occurrence patterns
Order of items does not matter (this is not sequence mining)
Your goal is recommendations, cross-sell, bundling, or pattern discovery

Typical datasets:

  • Shopping baskets (items bought together)
  • Website sessions (pages visited in the same session)
  • Medical prescriptions (drugs taken together)
  • Bank transactions (services used together)
  • Course registrations (subjects chosen together)

4) Real-Life Examples Where It’s Required

Example 1: Retail (Classic Market Basket)

A supermarket wants to increase sales by bundling products.

  • Rule found: {Milk} → {Bread}
  • Action: Place milk and bread closer, or show bread offer to milk buyers.

Example 2: E-Commerce Recommendations

Amazon/Flipkart-style recommendations:

  • Rule found: {Mobile Phone} → {Screen Guard, Back Cover}
  • Action: “Frequently bought together” suggestions.

Example 3: Healthcare / Pharmacy

Identify frequently co-prescribed medicines:

  • Rule: {Diabetes Medicine} → {Blood Pressure Medicine}
  • Action: Better stock planning, clinical insight checks.

Example 4: Education / Course Selection

University finds which courses students choose together:

  • Rule: {Python} → {Data Science}
  • Action: Recommend learning pathways.

Example 5: Banking / Financial Services

Find which services are commonly used by same customer:

  • Rule: {Savings Account} → {Debit Card, Mobile Banking}
  • Action: targeted product offers.

5) Core Terms You Must Know

(A) Support

How frequently an itemset appears in the dataset.

Example:
If 100 transactions exist and 20 contain {Milk}, then
Support(Milk) = 20/100 = 0.20

(B) Confidence

How often B appears when A appears.

Confidence(A → B) = Support(A B) / Support(A)

Example:
If Milk appears in 20 baskets, and Milk+Bread appears in 12 baskets,
Confidence(Milk → Bread) = 12/20 = 0.60

(C) Lift

Shows whether A and B occur together more than chance.

Lift(A → B) = Confidence(A → B) / Support(B)

Interpretation:

  • Lift > 1: Positive association (useful rule)
  • Lift = 1: No real association
  • Lift < 1: Negative association

Download Dataset : groceries - groceries.csv


 

टिप्पणी पोस्ट करा

0 टिप्पण्या