2014-11-18 16:38 GMT+01:00 Chris Holdgraf <choldg...@berkeley.edu>:
> Sometimes this works, but sometimes it doesn't. For example, if I use
> LinearSVC as my model, then setting .coef_ works fine. However, if I use
> SVC(kernel='linear'), then I get an attribute error when I try to set any
> attribute.
>
> Can someone explain the inconsistency in behavior here? Is there a better
> way to do things like this in sklearn?

It's an implementation detail. In SVC, the coef is a computed property
that is not actually used for computing the decision function (so
changing it makes no difference in behavior). Quoting from the code:

        # coef_ being a read-only property, it's better to mark the value as
        # immutable to avoid hiding potential bugs for the unsuspecting user.

(sklearn/svm/base.py)

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to