開始使用免費開始

使用 lift 曲線的商業案例

在影片中你學到如何實作一個計算活動獲利的方法:

profit = profit(perc_targets, perc_selected, population_size, campaign_cost, campaign_reward)

在這個方法中,perc_targets 是你為活動所選族群中的目標比例,perc_selected 是被選入活動的人口百分比,population_size 是整體母體大小,campaign_cost 是針對單一人執行活動的成本,campaign_reward 是成功觸及一個目標的回饋。

在這個練習中,你會針對一個特定案例,比較「對所有捐款者進行行銷」與「只對前 40% 的捐款者進行行銷」兩種做法的獲利,來判斷是否值得使用模型。

本練習屬於課程

Python 預測分析入門

檢視課程

練習說明

  • 繪製 lift 曲線。預測值在 predictions_test,實際目標值在 targets_test
  • 讀取在 40% 時的 lift 值並填入。
  • 活動相關資訊已在指令碼中填好。計算對整體母體進行行銷時的獲利。
  • 計算只對前 40% 進行行銷時的獲利。

動手互動練習

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

# Plot the lift graph
skplt.metrics.plot_lift_curve(____, ____)
plt.show()

# Read the lift at 40% (round it up to the upper tenth)
perc_selected = 0.4
lift = ____

# Information about the campaign
population_size, target_incidence, campaign_cost, campaign_reward = 100000, 0.01, 1, 100
    
# Profit if all donors are targeted
profit_all = profit(____, 1, population_size, campaign_cost, campaign_reward)
print(profit_all)

# Profit if top 40% of donors are targeted
profit_40 = profit(____ * ____, 0.4, population_size, campaign_cost, campaign_reward)
print(profit_40)
編輯並執行程式碼