I have some questions regarding SVM and regression.
1) How to interpret SVM (regression) results.
2) How to make a proper plot (containing decent information)
e1071
's tune() is used to uncover the best cost (C) and gamma (y) parameters. The model is fitted against a training set (train2).
svm.radial = tune( svm , dep_sev_fu ~ . , data = train2 , kernel = "radial" , type = "eps-regression" , ranges = list( cost = c(0.001 , 0.01 , 0.1 , 1 , 5 , 10 , 50 ) , gamma = c( .0001 , .001 , .01 , .1 , 1 , 5 , 10 ) ) )
Optimal model is fitted against test set:
svm.tuned <- svm( dep_sev_fu ~ . , data = test , kernel = "radial" , type = "eps-regression" , ranges = list( cost = 1 , gamma = .01 , epsilon = .1 ) )
In order to extract (significant) regression weights, there's a function called 'rfe' within caret
that applies backward selection. But it is unclear how to specify a model when using SVR.
I looked at a kernlab example, where they mention the W
vector. After running w = t(svm.tuned$coefs) %*% svm.tuned$SV
a vector of coefficients emerge. But how do I know if they are significant weights?
Note: Do I need to predict() of some sort? Not really sure how validation should work at this step
Bonus
Expanding on the validation approach, how can I fit using 10-fold CV?
* Example of the first 10 cases & 8 variables *
disTypecomorbid.disorder disTypedepressive.disorder Sexemale Age aedu IDS BAI FQ
1 0 0 50 10 6 10 4
0 1 0 35 11 7 5 2
0 0 0 51 15 4 3 14
0 1 0 43 15 11 7 3
0 0 0 38 10 7 8 15
1 0 0 38 10 15 15 32
0 0 0 45 9 12 12 2
0 0 0 57 9 9 14 4
1 0 0 43 10 12 3 0
1 0 1 49 11 14 11 3