How to fix Statsmodel warning: “Maximum no. of iterations has exceeded”

后端 未结 2 2132
囚心锁ツ
囚心锁ツ 2021-02-14 20:08

I am using Anaconda and I am trying logistic regression. After loading training data set and performed the regression. Then I got the following warning message.



        
2条回答
  •  我在风中等你
    2021-02-14 20:50

    There are two possibilities

    1) difficult optimization problem: Usually Logit converges very fast and the default number of iteration is set very low. Adding a larger maxiter keyword in the call to fit or refitting with the previous result as start_params helps in most cases.

    2) Since this is Logit, it is possible that there is complete separation, or quasi-complete separation. In this case some parameters might go off to infinity and the optimization stops at some convergence or stopping criterion. Logit detect the simple case of full separation and raises an exception, but there could be partial separation that is not detected. With perfect separation you get perfect predictability for some or all cases, which is useful for prediction but causes problems in estimating and identifying the parameters. More information is for example here https://stats.stackexchange.com/questions/11109/how-to-deal-with-perfect-separation-in-logistic-regression There are also several FAQ issues on the statsmodels github issues for corner cases and problems like this.

提交回复
热议问题