lifetimes icon indicating copy to clipboard operation
lifetimes copied to clipboard

issue with converge

Open huyns0806 opened this issue 4 years ago • 2 comments

Dear all,

i have RFM dataset with large value, ex:

ex1.xlsx When i use BG/NBD model i get error 'The model did not converge. Try adding a larger penalizer to see if that helps convergence.'

any suggestion?

huyns0806 avatar Sep 08 '20 04:09 huyns0806

I ran into that issue as well. I found that increasing the tolerance (the tol) argument solved the problem. For me increasing it from 1e-7 to 1e-4 solved the issue.

When I was looking into the issue I found that the model was in fact converging, but the the magnitude of the jacobian of the loss function was larger than the tolerance when the optimizer (scipy.minimize) couldn't find a more optimal value in the search direction. I don't know why this occurs. One can check that the parameters are converging to the right values by comparing to optimizing using the 'Nelder-Mead' optimization algorithm which does not have the convergence problem (but is much slower - more than 10x slower than 'BFGS' which is used now).

IsaacBenghiat avatar Oct 22 '20 19:10 IsaacBenghiat

bgf.fit(summary_cal_holdout['frequency_cal'], summary_cal_holdout['recency_cal'], summary_cal_holdout['T_cal'], tol=1e-04) , changing tol worked, thanks

nesrinozcan avatar Dec 23 '22 08:12 nesrinozcan