使用提升曲线的业务案例
在视频中,您学习了一个用于计算营销活动利润的方法:
profit = profit(perc_targets, perc_selected, population_size, campaign_cost, campaign_reward)
在该方法中,perc_targets 是您为活动所选择人群中的目标占比,perc_selected 是被选入活动的人群占比,population_size 是总体规模,campaign_cost 是对单个人进行触达的成本,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)