Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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