📊

Understanding A Priori Algorithm for Association Rules

Jun 2, 2025

Lecture on A Priori Algorithm for Generating Strong Association Rules

Introduction

  • Topic: Application of A Priori Algorithm.
  • Goal: Generate strong association rules from a dataset.
  • Minimum support: 40%.
  • Minimum confidence: 70%.

Dataset Overview

  • Consists of 5 transaction IDs.
  • Products include bread, butter, milk, beer, cookies, diapers, etc.

Steps in Applying A Priori Algorithm

Step 1: Generate Frequent Item Sets

  1. Generate Initial Item Sets:

    • Identify unique products: bread, butter, milk, diaper, beer.
    • Write these as 1-item sets.
  2. Calculate Support Count:

    • Count product appearances (e.g., bread appears 3 times).
    • Determine support count threshold: 40% of 5 transactions = 2.
    • Identify frequent 1-item sets (e.g., all except cookies).
  3. Generate 2-item Sets:

    • Create combinations of 2-item sets from frequent 1-item sets.
    • Calculate support for combinations (e.g., bread & butter: 3 times).
    • Identify frequent 2-item sets (e.g., bread & milk, bread & butter).
  4. Generate 3-item Sets:

    • Identify combinations of 3-item sets.
    • Calculate support for each (e.g., bread, butter & milk: 2 times).
    • Identify frequent 3-item sets that meet support threshold.
  5. Attempt to Generate 4-item Sets:

    • Not possible due to lack of enough items.

Step 2: Generate Association Rules

  1. Calculate Confidence for Rules:

    • Formula: (Support of X & Y) / (Support of X).
  2. Evaluate Rules Based on Confidence:

    • Example Rules: Bread & Butter
      • Bread → Butter: 100% confidence.
      • Butter → Bread: 100% confidence.
    • Example Rules: Bread & Milk
      • Bread → Milk: 67% confidence (not strong).
      • Milk → Bread: 100% confidence.
    • Repeat for other combinations like butter & milk, diaper & beer.
  3. 3-item Set Rules Evaluation:

    • Bread, butter, milk combinations.
    • Use logic to write various possibilities.
    • Evaluate each for confidence and strength.

Conclusion

  • The process involves generating frequent item sets and evaluating association rules.
  • Strong rules are identified based on confidence exceeding the threshold.
  • Practical application of A Priori algorithm.

Additional Information

  • Encourage watching other solved examples for further understanding.
  • Subscribe for more educational content.

This guide simplifies the steps necessary to apply the A Priori algorithm, illustrating how to identify frequent item sets and create strong association rules from a dataset.