Solving SVM classifier with two weight vectors

89 Views Asked by At

I am trying to implement a paper that basically proposes the following way to train two classifiers on some data with two types of labels. I do not know how to tweak existing solvers for SVM to do the same. Any help would be appreciated!

Here is the formulation: $$ ||w_a||^2 + ||w_b||^2 + C\sum_{n=1} \xi_n $$ such that $$ \beta * y_a * w_a^T* X + (1 - \beta) * y_b *w_b^T *X > 1 - \xi_n $$

where $w_a$ and $w_b$ are two weight vectors and $\xi$ is the slack variable, $C$ is tradeoff between training and testing. $\beta$ is learnt via hill climbing while training.

I follow basic SVM formulation (both primal and dual), how do I code for this particular formulation?

1

There are 1 best solutions below

5
On BEST ANSWER

You are missing $y$ (the label) in your proposed formulation. You should fix that.

Hint: $$\|w_a\|^2 + \|w_b\|^2 = \|[w_a : w_b]\|^2$$ Also, $$y_i(\beta w_a^{\top}x_i + (1-\beta)w_b^{\top}x_i) \geq 1 - \xi_i$$ is same as, $$y_i([w_a:w_b]^{\top}[\beta x_i : (1-\beta)x_i]) \geq 1 - \xi_i$$

Based on the edited question:

Since, you have two separate labels for each weight, that will be a bit difficult to handle if you simply plan to use existing SVM libraries without modifications. However, if you are willing to modify the libraries, then you can handle the constraints by noting that, $$[w_a:w_b]^{\top}[\beta y_{ai} x_i : (1-\beta)y_{bi} x_i] \geq 1 - \xi_i$$

With a small modification to existing libraries (find out the location where they construct the constraint vectors and modify suitably), you should be able to use existing solvers to find the weight vectors.