from lifetimes.datasets import load_cdnow_summary_data_with_monetary_value
data = load_cdnow_summary_data_with_monetary_value()
data.head()
frequency recency T monetary_value
customer_id
1 2 30.43 38.86 22.35
2 1 1.71 38.86 11.77
6 7 29.43 38.86 73.74
7 1 5.00 38.86 11.77
9 2 35.71 38.86 25.55
然后拟合BG模型:
^{pr2}$
第2步:拟合伽马-伽马模型
# Filter out customers who did not return
returning_customers_summary = data[data['frequency']>0]
from lifetimes import GammaGammaFitter
ggf = GammaGammaFitter(penalizer_coef = 0)
ggf.fit(returning_customers_summary['frequency'],
returning_customers_summary['monetary_value'])
是的。从documentation Estimating customer lifetime value using the Gamma-Gamma model开始。在
步骤1:适合BG模型
确保您有
frequency, monetary_value
格式的数据,例如:然后拟合BG模型:
^{pr2}$第2步:拟合伽马-伽马模型
第三步:估算寿命值
在这里,您将调用fitted gamma gamma函数,并使用先前拟合的BetaGeoFilter和一组客户数据,其中包含{frequency,recency,T,以及他们的花费/事件(
monetary_value
)}(以天为单位),以及一个以个月为单位的时间线和一个月折扣率。在相关问题 更多 >
编程相关推荐