Different penalty for support vector machine

here comes a question about the penalty for different groups in SVM.

The data is to be separated into two classes, one is class A and one is class B. In traditional SVM, a wrong classification in A is taken the same with a wrong classification in B. My question is, how could I make the weights different? I.e. if I make a mistake by classifying data into A, I will be punished by 5 point. And if I make a mistake by classifying data into B, I will be punished by 1 point only.

Current thoughts: Could I change y of the training set (x,y)? In above scenario, I will change y of data in set A into 0.2, so that the margin will be larger at side of A. And the y in set B will be -1.

However, it seems that many SVM lib does not support that kind of change... Could I get some opinions from you?

Thank you very much.

Best

1 Answer

As far as I know, StructSVM gives you this freedom to define your own cost function:

http://www.cs.cornell.edu/people/tj/svm_light/svm_struct.html

So you can define it to be weighted.