Leverage और conviction

Python में Market Basket Analysis

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

सरल मैट्रिक्स पर आगे बढ़ना

$$Support(X) = \frac{Frequency(X)}{N}$$

$$Support(X \rightarrow Y) = \frac{Frequency(X \& Y)}{N}$$

$$Confidence(X \rightarrow Y) = \frac{Support(X \rightarrow Y)} {Support(X)}$$

$$Lift(X \rightarrow Y) = \frac{Support(X \rightarrow Y)}{Support(X) Support(Y)}$$

Python में Market Basket Analysis

Leverage मैट्रिक

  • Leverage भी support पर आधारित है।

 

$$Leverage(X \rightarrow Y) = $$ $$Support(X \& Y) - Support(X) Support(Y)$$

  • Leverage, lift जैसा है, पर समझना आसान है।
  • Leverage -1 से +1 की रेंज में होता है।
    • Lift 0 से अनंत तक होता है।
Python में Market Basket Analysis

Leverage निकालना

# Compute support for Twilight and Harry Potter
supportTP = np.logical_and(books['Twilight'], books['Potter']).mean()

# Compute support for Twilight
supportT = books['Twilight'].mean()

# Compute support for Harry Potter
supportP = books['Potter'].mean()
# Compute and print leverage
leverage = supportTP - supportP * supportT
print(leverage)
0.018
Python में Market Basket Analysis

Conviction मैट्रिक

  1. Conviction भी support से बनता है।
  2. Leverage की तुलना में ज्यादा जटिल और कम सहज।

 

$$Conviction(X \rightarrow Y) = $$ $$\frac{Support(X) Support(\bar{Y})} {Support(X \& \bar{{Y}})}$$

Python में Market Basket Analysis

Conviction की व्याख्या

Twilight का एक थंबनेल चित्र.

Harry Potter and the Sorcerer's Stone का एक थंबनेल चित्र.

Twilight का एक थंबनेल चित्र.

The Hunger Games का एक थंबनेल चित्र.

1 Images taken from goodreads.com.
Python में Market Basket Analysis

Conviction निकालना

# Compute support for Twilight and Harry Potter and Twilight
supportTP = np.logical_and(books['Twilight'], books['Potter']).mean()
supportT = books['Twilight'].mean()
# Compute support for NOT Harry Potter
supportnP = 1.0 - books['Potter'].mean()
# Compute support for Twilight and NOT Harry Potter
supportTnP = supportT - supportPT
# Compute conviction
conviction = supportT*supportnP / supportTnP
print(conviction)
1.16
Python में Market Basket Analysis

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

Python में Market Basket Analysis

Preparing Video For Download...