How to fix Statsmodel warning: "The maximum number of iterations exceeded"

I am using Anaconda and I am trying logistic regression. After loading the training dataset and performing the regression. Then I received the following warning message.

train_cols = data.columns[1:]
logit = sm.Logit(data['harmful'], data[train_cols])
result = logit.fit() 
Warning: Maximum number of iterations has been exceeded.
     Current function value: 0.000004
     Iterations: 35
C:\Users\dell\Anaconda\lib\site-packages\statsmodels\base\model.py:466: ConvergenceWarning: Maximum Likelihood optimization failed to converge. Check mle_retvals"Check mle_retvals", ConvergenceWarning)

Why do I need this warning and how can I fix it? Thanks!

+4
source share
1 answer

There are two possibilities.

1) : Logit , . maxiter fit , start_params .

2) Logit, , . , . Logit , , . , , . , , https://stats.stackexchange.com/questions/11109/how-to-deal-with-perfect-separation-in-logistic-regression github statsmodels .

+4

Source: https://habr.com/ru/post/1610111/


All Articles