On the choice of max_iter

how do you orient yourself in choosing max_iter value ?
It is a trial and error procedure ? starting from very high numbers (100000 as an example) and decreasing it until you reach convergence…

Indeed, you can use a large value and the algorithm will anyway stop before it reaches convergence.
Scikit-learn tries to provide sensible default and we hope that you don’t need to increase often this value. However, it might happen that you get a convergence warning and in this case, you should increase max_iter.

The bottom line is: use the default but never ignore the ConvergenceWarning because it will have an impact on the estimator.

1 Like