8

There are already posts about warnings from R dealing with logistic regression and linear separation such as this one. I just wanna make sure if in Python Scikit Learn this problem is all solved by the L1/L2 regularization part in the optimization function. In other words, it's safe to say users will not get any infinite MLE estimates warnings from sklearn.linear_model.LogisticRegression?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
Nicholas
  • 495
  • 5
  • 11

1 Answers1

7

Yes, sklearn.linear_model.LogisticRegression uses penalized logistic regression which "solves" the problem of perfect separation. If you set C to something too large, you might still end up with bad results, though.

Danica
  • 21,852
  • 1
  • 59
  • 115