리프트 곡선을 활용한 비즈니스 사례
영상에서 캠페인 이익을 계산하는 메서드를 구현하는 방법을 배웠습니다:
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)