Đòn bẩy và độ xác tín

Phân tích giỏ hàng trong Python

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

Xây trên các thước đo đơn giản hơn

$$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)}$$

Phân tích giỏ hàng trong Python

Thước đo đòn bẩy

  • Đòn bẩy cũng dựa trên độ hỗ trợ.

 

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

  • Tương tự lift nhưng dễ diễn giải hơn.
  • Đòn bẩy nằm trong khoảng -1 đến +1.
    • Lift từ 0 đến vô cực.
Phân tích giỏ hàng trong Python

Tính đòn bẩy

# 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
Phân tích giỏ hàng trong Python

Thước đo độ xác tín

  1. Độ xác tín cũng dựa trên hỗ trợ.
  2. Phức tạp hơn và kém trực quan hơn đòn bẩy.

 

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

Phân tích giỏ hàng trong Python

Diễn giải độ xác tín

Ảnh thu nhỏ của Twilight.

Ảnh thu nhỏ của Harry Potter and the Sorcerer's Stone.

Ảnh thu nhỏ của Twilight.

Ảnh thu nhỏ của The Hunger Games.

1 Hình ảnh từ goodreads.com.
Phân tích giỏ hàng trong Python

Tính độ xác tín

# 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
Phân tích giỏ hàng trong Python

Ayo berlatih!

Phân tích giỏ hàng trong Python

Preparing Video For Download...