開始使用免費開始

使用多重指標過濾來交叉推廣書籍

最後一個需求是,這家電子書新創的創辦人請你再做一次額外的過濾。你先前的結果回傳了 82 條規則,但她只想要 1 條。rules 資料集已再次在主控台中提供。Zhang 的指標也已為你計算好,並以 zhang 欄位加入到 rules DataFrame。

本練習屬於課程

Python 的 Market Basket Analysis

檢視課程

練習說明

  • 將 lift 閾值設為大於 1.5。
  • 使用 1.0 的 conviction 閾值。
  • 要求 Zhang 的指標必須大於 0.65。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Set the lift threshold to 1.5
rules = rules[rules['____'] > ____]

# Set the conviction threshold to 1.0
rules = rules[____]

# Set the threshold for Zhang's rule to 0.65
rules = ____

# Print rule
print(rules[['antecedents','consequents']])
編輯並執行程式碼