Leverage ve conviction

Python ile Market Basket Analysis

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

Basit metriklerin üzerine inşa etmek

$$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 ile Market Basket Analysis

Leverage metriği

  • Leverage da support üzerine kurulur.

 

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

  • Leverage, lift'e benzer ama yorumlaması daha kolaydır.
  • Leverage -1 ile +1 arasında yer alır.
    • Lift 0'dan sonsuza kadar gider.
Python ile Market Basket Analysis

Leverage hesaplama

# Twilight ve Harry Potter için support'u hesapla
supportTP = np.logical_and(books['Twilight'], books['Potter']).mean()

# Twilight için support'u hesapla
supportT = books['Twilight'].mean()

# Harry Potter için support'u hesapla
supportP = books['Potter'].mean()
# Leverage'ı hesapla ve yazdır
leverage = supportTP - supportP * supportT
print(leverage)
0.018
Python ile Market Basket Analysis

Conviction metriği

  1. Conviction da support kullanılarak kurulur.
  2. Leverage'dan daha karmaşık ve daha az sezgiseldir.

 

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

Python ile Market Basket Analysis

Conviction'ı yorumlamak

Twilight'ın küçük bir görseli.

Harry Potter ve Felsefe Taşı'nın küçük bir görseli.

Twilight'ın küçük bir görseli.

Açlık Oyunları'nın küçük bir görseli.

1 Görseller goodreads.com'dan alınmıştır.
Python ile Market Basket Analysis

Conviction hesaplama

# Twilight ve Harry Potter ve Twilight için support'u hesapla
supportTP = np.logical_and(books['Twilight'], books['Potter']).mean()
supportT = books['Twilight'].mean()
# Harry Potter OLMAYAN için support'u hesapla
supportnP = 1.0 - books['Potter'].mean()
# Twilight ve Harry Potter OLMAYAN için support'u hesapla
supportTnP = supportT - supportPT
# Conviction'ı hesapla
conviction = supportT*supportnP / supportTnP
print(conviction)
1.16
Python ile Market Basket Analysis

Hadi pratik yapalım!

Python ile Market Basket Analysis

Preparing Video For Download...