リフト曲線を使ったビジネスケース
動画では、キャンペーンの利益を計算するメソッドを実装しました。
profit = profit(perc_targets, perc_selected, population_size, campaign_cost, campaign_reward)
このメソッドでは、perc_targets はキャンペーンで選択するグループにおけるターゲットの割合、perc_selected はキャンペーンで選択される人数の割合、population_size は母集団の総人数、campaign_cost は 1 人にアプローチするコスト、campaign_reward はターゲットにアプローチしたときのリワードです。
この演習では、すべての寄付者にアプローチする場合と、寄付者の上位 40% にアプローチする場合の利益を比較し、特定のケースでモデルを使うことが有効かどうかを確認します。
この演習はコースの一部です
Pythonで学ぶ予測分析入門
演習の手順
- リフト曲線をプロットします。予測値は
predictions_test、真のターゲット値はtargets_testにあります。 - 40% 時点のリフト値を読み取り、入力します。
- キャンペーンに関する情報はスクリプトに用意されています。母集団全体にアプローチした場合の利益を計算します。
- 上位 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)