세분화된 CLV 계산하기
이번 실습에서는 인보이스 단위의 더 세분화된 데이터 포인트를 사용해 보겠습니다. 이 접근법은 더 세밀한 데이터를 활용하여 고객 생애가치(CLV)를 더 정확하게 추정할 수 있어요. 기본 CLV 모델의 결과와 반드시 비교해 보세요.
pandas와 numpy 라이브러리는 각각 pd, np로 로드되어 있어요. online 데이터셋도 미리 불러와 두었습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 마케팅용 Machine Learning
연습 안내
InvoiceNo로 그룹화하고TotalSum열의 평균을 계산하세요.CustomerID와InvoiceMonth로 그룹화하고 고객별 월별 고유 인보이스 수의 평균을 계산하세요.- lifespan을 36개월로 정의하세요.
- 앞의 세 가지 지표를 곱하여 세분화된 CLV를 계산하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Calculate average revenue per invoice
revenue_per_purchase = online.___(['___'])['TotalSum'].mean().mean()
# Calculate average number of unique invoices per customer per month
frequency_per_month = online.___(['CustomerID','InvoiceMonth'])['___'].___().mean()
# Define lifespan to 36 months
lifespan_months = 36
# Calculate granular CLV
clv_granular = ___ * frequency_per_month * lifespan_months
# Print granular CLV value
print('Average granular CLV is {:.1f} USD'.format(clv_granular))