# maximising margin in svm

I have been thinking of this case as i was reading other questions and answers about SVM.

A question was raised about an SVM model having 1000 data points and 800 support vectors. The OP used a linear kernel. However, this is something that confuses me. If an SVM is supposed to maximise the margin between the 2 classes. How would the increase in number of support vectors feature in this calculations?

How to ensure that all the vectors are maximimum margin from each other?

I would suggest you to look at SVM from another point of view: It is minimizing hinge loss with L2 regularization. This interpretation works better than maximize the margin interpretation when data is not linearly separable.

Increasing the regularization will increase number of the support vectors.

library(kernlab)
library(mlbench)
set.seed(0)
d=mlbench.2dnormals(100)
svp1 <- ksvm(d$x,d$classes,type="C-svc",kernel="polydot",C=0.1)
plot(svp1,data=d$x) svp2 <- ksvm(d$x,d$classes,type="C-svc",kernel="polydot",C=10000) plot(svp2,data=d$x)


In above simulation we are changing the regularization parameter $C$ to have different numbers of support vectors (shown in black in the plot) in a toy data set.

• minimizing the hinge loss would require as many data points as needed? Can i have a more detailed explaination – aceminer Oct 4 '16 at 14:13
• @aceminer would the example help? libsvm paper section 2.1 will give you math details. – hxd1011 Oct 4 '16 at 14:22
• So just to confirm is this in high dimensional data? Or data in 2d. Not too good with r – aceminer Oct 4 '16 at 14:42
• @aceminer 2D data. 2 classes, ground truth label are circle and triangle. – hxd1011 Oct 4 '16 at 15:46