3
$\begingroup$

I'm working through Stanford's computer vision course to refresh some of my math skills (http://vision.stanford.edu/teaching/cs223b/syllabus.html), and I've run into a problem while working with a simple 2d Support Vector Machine.

Basically, the SVM library I am using only returns the vector 'w', which is the normal to the hyperplane (or line in 2d). I have verified that I am getting the correct value. The problem is, it does not contain 'b' in the equation:

w.x + b = 0

How do I compute 'b', so that when I draw the line it correctly bisects my data?

Also, I've noticed that the library I'm using (liblinear for those interested) assumes that the hyperplane bisects the origin (again, it doesn't use 'b'). I believe it assumes that the data is centered about the origin? My question is, can I simply take the average position (avg) and translate all of my data points by avg? Is there a preferred method to prep the data before running it through a SVM?

  • 2
    Are you sure your library doesn't return the displacement? Although easy to calculate in principle, you need to be able to apply the kernel, so the library probably does supply $b$. Also, in some cases the data isn't separable and then you need to know the "penalty factor" to be able to calculate $b$.2011-01-26
  • 0
    Thanks. I will try looking at some other libraries and see if they return the displacement.2011-01-26
  • 0
    Are you doing classification or regression? I believe that you can recover $b$ from the KKT conditions. There are several good sights which cover the techniques. http://en.wikipedia.org/wiki/Support_vector_machine2011-03-27
  • 0
    [Scikits.learn](http://scikit-learn.org/stable/), which is a Python layer over LIBSVM, does return the bias parameter within SVM objects. It's easy to use; I would consider it.2012-03-22

1 Answers 1