Skip to main content

What tripped me up:

  • disable sklearn regularization LogisticRegression(C=1e9)

  • add statsmodels intercept sm.Logit(y, sm.add_constant(X)) OR disable sklearn intercept LogisticRegression(C=1e9, fit_intercept=False)

  • sklearn returns probability for each class so model_sklearn.predict_proba(X)[:, 1] == model_statsmodel.predict(X)

  • Useuse of predict fucntionfunction model_sklearn.predict(X) == (model_statsmodel.predict(X)>0 > 0.5).astype(int)

I'm now seeing the same results in both libraries.

What tripped me up:

  • disable sklearn regularization LogisticRegression(C=1e9)

  • add statsmodels intercept sm.Logit(y,sm.add_constant(X)) OR disable sklearn intercept LogisticRegression(C=1e9,fit_intercept=False)

  • sklearn returns probability for each class so model_sklearn.predict_proba(X)[:,1] == model_statsmodel.predict(X)

  • Use of predict fucntion model_sklearn.predict(X) == (model_statsmodel.predict(X)>0.5).astype(int)

I'm now seeing the same results in both libraries.

What tripped me up:

  • disable sklearn regularization LogisticRegression(C=1e9)

  • add statsmodels intercept sm.Logit(y, sm.add_constant(X)) OR disable sklearn intercept LogisticRegression(C=1e9, fit_intercept=False)

  • sklearn returns probability for each class so model_sklearn.predict_proba(X)[:, 1] == model_statsmodel.predict(X)

  • use of predict function model_sklearn.predict(X) == (model_statsmodel.predict(X) > 0.5).astype(int)

I'm now seeing the same results in both libraries.

Source Link
citynorman
  • 201
  • 2
  • 3

What tripped me up:

  • disable sklearn regularization LogisticRegression(C=1e9)

  • add statsmodels intercept sm.Logit(y,sm.add_constant(X)) OR disable sklearn intercept LogisticRegression(C=1e9,fit_intercept=False)

  • sklearn returns probability for each class so model_sklearn.predict_proba(X)[:,1] == model_statsmodel.predict(X)

  • Use of predict fucntion model_sklearn.predict(X) == (model_statsmodel.predict(X)>0.5).astype(int)

I'm now seeing the same results in both libraries.