View Single Post
  #2  
Old 06-10-2013, 01:32 PM
jforbes jforbes is offline
Member
 
Join Date: Apr 2013
Posts: 12
Default Re: Q14 bizarre results

Quote:
Originally Posted by Steph View Post
Hi,

Just wondering if anyone has encountered what I'm seeing, or if (more likely) I'm doing something stupid...

I'm using the svm command in the e1071 package in R to implement hard margin SVM. Working on Q14, Ein is often not 0, but most of the time when Ein > 0, I actually get Ein = 100. That is, the data set is linearly separable in the Z space, but for some reason the response values are exactly flipped.

This seems bizarre to me, yet I can't figure out why it might be happening. I'm wondering if I'm not correctly implementing the constant "b". I simply added a column of ones to my x matrix and moved forward with svm.

Any thoughts would be much appreciated.

Thanks,
Steph
I believe the bias is already accounted for in the SVM formalism without adding a column of 1's, i.e. the x's you give to SVM should really be just two-dimensional. To compute b, you can go back after you've received the alpha's from QP and calculate

b = y_m - Sum over support vectors (alpha_n * y_n * K(x_n,x_m))

where the dummy variable in the sum is n, and m is the index of any support vector. b should be the same no matter which SV you use.
Reply With Quote