# How do I find slack variables in SVM?/ Distance to the boundary?

48 views (last 30 days)

Show older comments

Hi, I used "svmtrain" to train the algorithm: svmStruct=svmtrain(xdata,group); I used "svmclassify" to classify.

My data is not perfectly linearly separable but I still used a linear classifier. In theory, allowances are made for by a slack variable. (Soft margin) I refer to the toolbox help where the theory is. It mentions the slack variable and 2 ways it is computed. http://www.mathworks.com/help/bioinfo/ug/support-vector-machines-svm.html

My issue is that, svmStruct does not save the slack variable. Neither can I find it in the function to recall it and save it.

If not, how can I find the distance from each data point to the boundary?

Can anyone help me with this? Thanks

##### 0 Comments

### Answers (2)

the cyclist
on 8 Feb 2013

It is the input parameter 'boxconstraint' to the svmtrain() command. The default value is 1.

##### 5 Comments

Ilya
on 10 Feb 2013

##### 6 Comments

Aliza Rubenstein
on 19 Jan 2017

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!