ffx icon indicating copy to clipboard operation
ffx copied to clipboard

How to increase iterations?

Open RicardoFCJ opened this issue 4 years ago • 3 comments

I'm trying to train the models but it is not converging. I tried to set max_iter in regressor, but it is not recognizing it. This is the warning I'm getting.

ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.17428639502685428, tolerance: 0.0699999999999999

Should I just wait for it to finish, or, if not, how can I increase iterations?

RicardoFCJ avatar Apr 02 '20 19:04 RicardoFCJ

Hey @RicardoFCJ - I've seen this a bunch in the past but have never had a chance to debug what's going on. If you have time would love to hear what you learn.

If you grep the codebase for max_iter you can see it's hard-coded to 5000 right now; it may be worth experimenting with that. Also it should certainly not be hard-coded :)

natekupp avatar Apr 05 '20 02:04 natekupp

I'm sorry for the delayed response. (I'm not sure if that's what you're asking with "would love to hear what you learn", but ...) What I'm trying to learn is a dataset precision agriculture with 50 features and ~700 cases.

RicardoFCJ avatar Apr 17 '20 20:04 RicardoFCJ

I am reviving this, because I have problems with it aswell. If the duality gap is too large, results are really not so good because the optimization did not converge.

A manual fix is to increase max_iter in ffx/core/model_factories.py inside the _pathwiseLearn() function (l. 414).

However, I was thinking of a more permanent solution. Since **fit_params get's passed to _pathwiseLearn() anyway, we could use that dict to drag along max_iter from run() and from the constructor of the FFXRegressor. That would be a bit ugly and difficult to test so I am open to better suggestions.

maxiimilian avatar Jun 29 '21 09:06 maxiimilian