lifetimes
lifetimes copied to clipboard
issue with converge
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?
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).
bgf.fit(summary_cal_holdout['frequency_cal'], summary_cal_holdout['recency_cal'], summary_cal_holdout['T_cal'], tol=1e-04) , changing tol worked, thanks