एडवांस्ड नियम

Python में Market Basket Analysis

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

मार्केट बास्केट विश्लेषण का ओवरव्यू

  • मार्केट बास्केट विश्लेषण की मानक प्रक्रिया.
    1. बड़ी संख्या में नियम जनरेट करें.
    2. मेट्रिक्स से नियम फ़िल्टर करें.
    3. अंतर्ज्ञान और कॉमन सेंस लागू करें.
Python में Market Basket Analysis

नियम कैसे जनरेट होते हैं

  • आइटम्स बढ़ने पर नियमों की संख्या एक्सपोनेंशियली बढ़ती है.
    • अधिकतर नियम उपयोगी नहीं होते.
  • शुरुआती राउंड का फ़िल्टरिंग ज़रूरी है.
    • चैप्टर 3 में Apriori एल्गोरिदम से कवर किया गया है
Python में Market Basket Analysis

फ़िल्टरिंग कैसे काम करती है?

ID antecedents consequents support Lift
1 Harry Potter The Hunger Games 0.001 1.01
2 Hunger Games Twilight 0.020 1.23
3 Pride and Prejudice The Hobbit 0.030 1.05
4 The Hobbit Twilight 0.015 0.85
5 Harry Potter The Hobbit 0.010 1.07
Python में Market Basket Analysis

मल्टी-मेट्रिक फ़िल्टरिंग

ID antecedents consequents support zhang
1 Harry Potter The Hunger Games 0.001 -0.05
2 Hunger Games Twilight 0.020 0.17
3 Pride and Prejudice The Hobbit 0.030 0.06
4 The Hobbit Twilight 0.015 -0.04
5 Harry Potter The Hobbit 0.010 0.34
Python में Market Basket Analysis

मल्टी-मेट्रिक फ़िल्टरिंग करना

print(rules.head())
  antecedents consequents  antecedent support  ... support  confidence  ... conviction  
0 Potter      Hunger       0.48                ...  0.12  ... 0.26      ...  0.92
1 Potter      Hunger       0.32                ...  0.12  ... 0.26      ...  0.92 
2 Twilight    Hunger       0.26                ...  0.09  ... 0.35      ...  1.04
3 Hunger      Twilight     0.32                ...  0.09  ... 0.28      ...  1.03 
4 Mockingbird Hunger       0.48                ...  0.10  ... 0.20      ...  0.85
Python में Market Basket Analysis

मल्टी-मेट्रिक फ़िल्टरिंग करना

# Select subset of rules with low consequent support.
rules = rules[rules['consequent support'] < 0.05]
print(len(rules))
12
# Select subset of rules with lift > 1.5.
rules = rules[rules['lift'] > 1.5]
print(len(rules))
2
Python में Market Basket Analysis

अभ्यास करते हैं!

Python में Market Basket Analysis

Preparing Video For Download...