BTYD(买到死).演练.pnbd.EstimateParameters() [英] BTYD (Buy 'Till You Die). Walkthrough. pnbd.EstimateParameters()

查看:54
本文介绍了BTYD(买到死).演练.pnbd.EstimateParameters()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次研究 BTYD 程序.我在运行参数估计时出错.我在下面提供了错误消息.我一直在关注 BTYD - 演练.

有人知道如何解决这个问题吗?我处理了示例数据集,它工作正常.我以相同的格式上传了我的文件,但它不起作用.没有缺失或空的行/值.将不胜感激!

end.of.cal.period <- as.Date(2013-08-18")elog.cal <- elog[which(elog$date <= end.of.cal.period), ]split.data <- dc.SplitUpElogForRepeatTrans(elog.cal);clean.elog <- split.data$repeat.trans.elog;#clean.elogfreq.cbt <- dc.CreateFreqCBT(clean.elog);频率.cbt[1:3,1:5]tot.cbt <- dc.CreateFreqCBT(elog.cal) #used elog.cal 而不是 elogcal.cbt <- dc.MergeCustomers(tot.cbt, freq.cbt)birth.periods <- split.data$cust.data$birth.perlast.dates <- split.data$cust.data$last.datecal.cbs.dates <- data.frame(birth.periods, last.dates, end.of.cal.period)cal.cbs <- dc.BuildCBSFromCBTAndDates(cal.cbt, cal.cbs.dates,per=week") #works.没有错误头(cal.cbs,n = 10)sel <- cbind(cal.cbs)colnames(sel) <-c('x', 't.x', 'T.cal')头(sel,n=10)params <- pnbd.EstimateParameters(sel)

<块引用>

优化错误(logparams, pnbd.eLL, cal.cbs = cal.cbs, max.param.value= max.param.value, :L-BFGS-B 需要 'fn' 的有限值

解决方案

事实证明,在估计参数时,sel$x 中的大值会导致求幂爆炸和错误.

这个人在 github 上有一个修复:https://github.com/theofilos/BTYD

我基本上把他所有的代码都放在了 pnbd.R,并将其添加到我的 Pareto/NBD 分析代码中,似乎可以解决该问题.

This is the first time I am working on BTYD procedure. I am having errors running the parameter estimates. I have provided the error message below. I have been following the BTYD - Walkthrough.

Does anybody know how to fix this? I worked through the sample data set and it works fine. I uploaded my file in the same format, it wouldn't work. There are no missing or empty rows/values. Help would be greatly appreciated!!!

end.of.cal.period <- as.Date("2013-08-18")
elog.cal <- elog[which(elog$date <= end.of.cal.period), ]

split.data <- dc.SplitUpElogForRepeatTrans(elog.cal);
clean.elog <- split.data$repeat.trans.elog; 
#clean.elog
freq.cbt <- dc.CreateFreqCBT(clean.elog); 
freq.cbt[1:3,1:5]

tot.cbt <- dc.CreateFreqCBT(elog.cal) #used elog.cal instead of elog
cal.cbt <- dc.MergeCustomers(tot.cbt, freq.cbt)
  
birth.periods <- split.data$cust.data$birth.per
last.dates <- split.data$cust.data$last.date
cal.cbs.dates <- data.frame(birth.periods, last.dates, end.of.cal.period)
cal.cbs <- dc.BuildCBSFromCBTAndDates(cal.cbt, cal.cbs.dates,per="week") #works. no errors
head(cal.cbs, n=10)

sel <- cbind(cal.cbs)
colnames(sel) <-c('x', 't.x', 'T.cal')
head(sel, n=10)

params <- pnbd.EstimateParameters(sel)

Error in optim(logparams, pnbd.eLL, cal.cbs = cal.cbs, max.param.value = max.param.value, : L-BFGS-B needs finite values of 'fn'

解决方案

It turns out that when estimating the parameters, large values in sel$x will cause the exponentiation to blow up and error.

This guy has a fix on github here: https://github.com/theofilos/BTYD

I basically took all of his code in pnbd.R, and prepend it to my code for the Pareto/NBD analysis and it seems to fix that issue.

这篇关于BTYD(买到死).演练.pnbd.EstimateParameters()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆