स्कैटरप्लॉट्स

Python में Market Basket Analysis

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

स्कैटरप्लॉट्स का परिचय

यह चित्र एक स्कैटरप्लॉट का उदाहरण दिखाता है.

Python में Market Basket Analysis

स्कैटरप्लॉट्स का परिचय

  • स्कैटरप्लॉट मानों की जोड़ियाँ दिखाता है.
    • Antecedent और consequent support.
    • Confidence और lift.
  • कोई मॉडल मानकर नहीं चलता.
    • ट्रेंड लाइन या कर्व की ज़रूरत नहीं.
  • प्रूनिंग शुरू करने में मदद कर सकता है.
    • डेटा और नियमों में पैटर्न पहचानें.
Python में Market Basket Analysis

Support बनाम confidence

यह MovieLens डेटासेट के नियमों में support बनाम confidence का स्कैटरप्लॉट दिखाता है.

Python में Market Basket Analysis

Support बनाम confidence

यह MovieLens डेटासेट के नियमों में support बनाम confidence का स्कैटरप्लॉट दिखाता है.

1 Bayardo Jr., R.J. and Agrawal, R. (1999). Mining the Most Interesting Rules. In Proceedings of the Fifth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 145-154).
Python में Market Basket Analysis

स्कैटरप्लॉट जनरेट करना

import pandas as pd
import seaborn as sns
from mlxtend.frequent_patterns import association_rules, apriori

# Load one-hot encoded MovieLens data
onehot = pd.read_csv('datasets/movies_onehot.csv')
# Generate frequent itemsets using Apriori
frequent_itemsets = apriori(onehot, min_support=0.01, use_colnames=True, max_len=2)

# Generate association rules
rules = association_rules(frequent_itemsets, metric='support', min_threshold=0.0)
sns.scatterplot(x="antecedent support", y="consequent support", data=rules)
Python में Market Basket Analysis

स्कैटरप्लॉट जनरेट करना

यह चित्र antecedent support बनाम consequent support का स्कैटरप्लॉट दिखाता है.

Python में Market Basket Analysis

तीसरा मेट्रिक जोड़ना

 

sns.scatterplot(x="antecedent support", 
                y="consequent support", 
                size="lift", 
                data=rules)
Python में Market Basket Analysis

तीसरा मेट्रिक जोड़ना

यह स्कैटरप्लॉट antecedent support, consequent support, और lift के बीच संबंध दिखाता है.

Python में Market Basket Analysis

स्कैटरप्लॉट्स से क्या सीखें?

  • डेटा में नैचुरल थ्रेशहोल्ड पहचानें.
    • हीटमैप या अन्य विज़ुअलाइज़ेशन से कठिन.
  • पूरा डेटासेट विज़ुअलाइज़ करें.
    • कम नियमों तक सीमित नहीं.
  • निष्कर्षों से प्रून करें.
    • इन्हीं थ्रेशहोल्ड और पैटर्न से प्रून करें.
Python में Market Basket Analysis

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

Python में Market Basket Analysis

Preparing Video For Download...