Skip to content

[已解決] ConvergenceWarning: lbfgs failed to converge (status=1): STOP: TOTAL NO. of ITERATIONS REACHED L

Last Updated on 2021-10-30 by Clay

完整的報錯訊息為:

Start to train the model.
\sklearn\linear_model\_logistic.py:763: ConvergenceWarning: lbfgs failed to converge (status=1):

STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in:
    https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression  n_iter_i = _check_optimize_result(

\sklearn\linear_model\_logistic.py:763: ConvergenceWarning: lbfgs failed to converge (status=1):

STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in:
    https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression  n_iter_i = _check_optimize_result(


這個錯誤訊息的意思是 lbfgs 無法收斂,因為迭代次數達到上限而中止


解決方法

解決方法不外乎三種:

  • 增加迭代總數(max_iter 參數預設為 100)
  • 縮放資料規模(scale)
  • 更換其他求解器(solver)

References


Read More

Leave a Reply