Skip to content

Instantly share code, notes, and snippets.

@shivamkalra
Last active July 24, 2017 12:17
Show Gist options
  • Save shivamkalra/3981b0e90666cfead10cdb86d5592064 to your computer and use it in GitHub Desktop.
Save shivamkalra/3981b0e90666cfead10cdb86d5592064 to your computer and use it in GitHub Desktop.
from sklearn.metrics import accuracy_score
import statsmodels.api as sm
logit = sm.Logit(Y_train, X_train)
result = logit.fit()
print(result.summary2())
Y_p = np.zeros((len(Y_test), 1))
p = result.predict(X_test)
Y_p[p > 0.5] = 1.
print(accuracy_score(Y_test, Y_p))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment