Skip to content

Instantly share code, notes, and snippets.

@baatout
Last active September 8, 2018 11:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baatout/3b4835948d8a22603122d7c8daa2c614 to your computer and use it in GitHub Desktop.
Save baatout/3b4835948d8a22603122d7c8daa2c614 to your computer and use it in GitHub Desktop.
Save model coefficients
# with X_train, X_test, Y_train, Y_test
from sklearn.linear_model import LogisticRegression
clf = LogisticRegression()
clf.fit(X_train, Y_train)
print(clf.score(X_test, Y_test))
import json
with open('logreg_coefs', 'w') as f:
json.dump(clf.coef_.tolist(), f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment