Hi,

I'm using sklearn for training a linear Support Vector Machine, but I cant
match dual_coef_ with coef_. Here goes the code:

X = np.array([[0, 0], [1, 1]])
y = np.array([0, 1])
clf = svm.SVC(kernel = "linear")
clf.fit(X, y)

this gives me a value for clf.dual_coef_ = [[ 1., -1.]] and clf.coef_ = [[
1.,  1.]]. How do I get from the dual_coef_ to the normal vector coef_
(w)? I understand from
http://scikit-learn.org/stable/modules/svm.html#svc
that the dual_coef_ are y_i * alpha_i. In that sense I would only need to
multiply by X and sum in each coordinate in order to get w, but this gives
me [1, -1].

This is just a test. I'm planning to use different kernels, and I
understand coef_ only works for linear kernels.

Thanks in advance,
Guillermo.




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to