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?
Coefficiants may help you do some other calculations. But if it's not the case, you can save the learned model to your disc and use it later without reinitializing.
here is an example: scikit learn SVM, how to save/load support vectors?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With