I simulate a simple linear setup:
n = 1000
X = runif(n)
Y = runif(n)
ind = X + 2*Y < 1
ind[ind == TRUE] = runif(sum(ind)) < 1
plot(X,Y,col = ind + 1)
Which gives
The svm()
functcion from e1071
performs very well but it gives me a lot of vectors.
Call:
svm(formula = ind ~ X + Y, type = "C-classification", kernel = "linear")
Parameters:
SVM-Type: C-classification
SVM-Kernel: linear
cost: 1
Number of Support Vectors: 99
Can you please tell me what and how should I tune to get one vector (or just a few)?
cost
parameter to have less support vectors. If the kernel you use is linear,gamma
is not used. $\endgroup$gamma
was there from my another tests, I will update the code. $\endgroup$e1071
package there is atune.svm
procedure, which takes a given set of parameters and does CV automatically, but this is a bit different story. Thanks for helping with this one :) $\endgroup$