-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
LogisticRegression and LinearSVC should have read-write coef_ and intercept_ attributes #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It is that after training a LR and get coef_ and intercept_ stored in disk, next time I could just get a new instance LR() and chage the coef_ and intercept_ fromin disk, the I don't need to train it again? |
Yes, that is what a164d57 ensures. You can just store the whole model, too, though: http://scikit-learn.org/dev/modules/model_persistence.html |
just changed the coef_ & intercept_ still can't work, it would ask for class_ or sth like that I have just used pickle and it work well thank you for the marvellous packege you guys development and you are the first foreigner I have speaked with! |
1 but prove needed that it works : changed coeffs are used for prediction? 2 |
As reported on this stackoverflow question the current implementation of liblinear models is using a special memory layout for the coefficient (currently stored in the
raw_coef_
array). Those coefficients are made read-only accessible to the user by means of the python propertiescoef_
andintercept_
. However this solution prevents the user to change some of the coefficient values or to reassign a completecoef_
array on a the fitted estimator.It would be much nicer to have
coef_
/intercept_
as traditional array attributes instead.Options:
coef_
/intercept_
layout and copy those parameters at prediction time to a temporary array suitable for prediction using liblinearpredict
andpredict_proba
in numpy instead of usingliblinear
at prediction time hence we could use standard numpy arrays with the usual layout forcoef_
andintercept_
The text was updated successfully, but these errors were encountered: