Logistic Regression HessianInversionWarning

2,620 views
Skip to first unread message

Krista Mar

unread,
Jun 1, 2019, 8:20:34 PM6/1/19
to pystatsmodels
What are the reasons for sm.Logit to fail?

I tried at first with part of my data set set aside for testing and got this error.

model = sm.Logit(y,X).fit(method='lbfgs', max_iterations= 100000)

HessianInversionWarning: Inverting hessian failed, no bse or cov_params available
  'available', HessianInversionWarning)

I tried again with difference solvers and with my whole dataset and got this message. 

ConvergenceWarning: Maximum Likelihood optimization failed to converge. Check mle_retvals
  "Check mle_retvals", ConvergenceWarning)

I tried stack overflow, but only found this question that is about when Y values are not 0 and 1, which mine are. Any suggestions? It is converging with sklearn's logistic regression. 

https://stackoverflow.com/questions/20703733/logit-regression-and-singular-matrix-error-in-python

Krista Mar

unread,
Jun 1, 2019, 8:46:14 PM6/1/19
to pystatsmodels
Actually I think I found a solution, using .fit_regularized
Reply all
Reply to author
Forward
0 new messages