2
votes

i am getting this error while processing for titanic dataset as I was implementing logistic regression. I cannot resolve the issue.

    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( LogisticRegression()

1

1 Answers

2
votes

This means that you need to increase your maximum iterations. I will show you where

class sklearn.linear_model.LogisticRegression(solver='lbfgs', max_iter=100)

Increase your max_iter to let's say 1000 and try running ur model.

Also, make sure your data is scaled because LogReg does not work well when your data has lots of scale difference between columns.