1 of 22

Finding Frequent Patterns and Association Rules

  • Using WEKA – Apriori Algorithm
  • Course: Databases and Data Mining
  • Instructor: Jamolbek Mattiev

2 of 22

Learning Objectives

  • • Understand frequent itemsets
  • • Learn Apriori algorithm
  • • Generate association rules in WEKA
  • • Interpret support, confidence, lift

3 of 22

Frequent Patterns

  • • Item combinations occurring frequently
  • • Extracted from transactional datasets
  • • Used for pattern discovery

4 of 22

Association Rules

  • • IF–THEN relationships
  • • Example: Bread → Butter
  • • Describe co-occurrence patterns

5 of 22

Key Metrics

  • • Support
  • • Confidence
  • • Lift

6 of 22

Support

  • Support(A→B) = P(A ∪ B)
  • Frequency of transactions containing both A and B

7 of 22

Confidence

  • Confidence(A→B) = P(B|A)
  • Probability of B given A

8 of 22

Lift

  • Lift(A→B) = Confidence / Support(B)
  • Lift > 1 indicates positive association

9 of 22

Apriori Algorithm Overview

  • • Level-wise search strategy
  • • Uses downward closure property
  • • Iterative candidate generation and pruning

10 of 22

Apriori Steps

  • 1. Generate candidate itemsets
  • 2. Calculate support
  • 3. Remove infrequent itemsets
  • 4. Generate association rules

11 of 22

Apriori Property

  • All subsets of frequent itemsets are frequent
  • Infrequent itemsets are pruned early

12 of 22

WEKA: Step 1

  • • Open WEKA Explorer
  • • Load dataset (.arff)
  • • Go to Associate tab

13 of 22

WEKA: Step 2

  • • Choose Apriori algorithm
  • • Set minimum support
  • • Set minimum confidence

14 of 22

WEKA: Step 3

  • • Set number of rules
  • • Adjust thresholds
  • • Click Start

15 of 22

Interpreting Output

  • • Frequent itemsets list
  • • Generated rules
  • • Support & confidence values

16 of 22

Support Threshold Impact

  • Higher support → fewer rules
  • Lower support → more rules
  • Trade-off between quantity and quality

17 of 22

Confidence Threshold Impact

  • Higher confidence → stronger rules
  • Too high → very limited rules

18 of 22

Applications

  • • Market basket analysis
  • • Recommendation systems
  • • Web mining
  • • Healthcare pattern discovery

19 of 22

Challenges

  • • Large rule sets
  • • Redundant rules
  • • Computational cost

20 of 22

Summary

  • • Apriori finds frequent itemsets
  • • Association rules measure relationships
  • • WEKA enables easy experimentation
  • • Threshold tuning is essential

21 of 22

Support Threshold Impact (Example)

22 of 22

Confidence Values for Example Rules