Say I run SGDRegressor
or SGDClassifier
, and get a set of coefficients that I want to use for the future. It's definitely trivial to do the basic predictions (since, for the regressor, it's just matrix multiplication), but it'd be nice to be able to get at the other methods on a fitted model (like predict_proba
, etc.). Is there a way to do this in general? I've been looking through the docs and couldn't find anything.
Specific code example for clarity:
from sklearn import linear_model
sgd = linear_model.SGDRegressor()
sgd.fit([[0, 1, 1], [0, -1, 1]], [0, 1])
coefs = sgd.coef_
intercept = sgd.intercept_
And what I'd like to do is just keep coefs
and intercept
stored somewhere and then be able to reinitialize a SGDRegressor
with them. Is that possible?
predict_proba
differs per loss function, so you'd better pickle the whole estimator. – Fred Foo