Kernlab ksvm setup
I want to use an SVM implementation in R to do some regression. I've already tried using svm
from e1071
, but I'm limited to the kernel features there. So I switched to ksvm
from kernlab
. But I have a major drawback: setup function was not represented kernlab
(eg tune.svm
in e1071
). Can someone explain how I can tweak the settings for the different kernels there?
PS. I want, in particular, use the kernel rbfdot
. So if at least someone can help me figure out how to set up sigma, I would be very grateful.
PPS. I fully understand that the value "automatic"
for kpar can be used to calculate a good sigma. But I need something more tangible and more along the lines tune.svm
.
source to share
Either you write your own wrapper (not that hard to be honest), or you can try already tried and tested implemented solutions like mlr
and caret
.
mlr
See the tutorial for an example about this .
ps = makeParamSet(
makeDiscreteParam("C", values = 2^(-2:2)),
makeDiscreteParam("sigma", values = 2^(-2:2))
)
ctrl = makeTuneControlGrid()
rdesc = makeResampleDesc("CV", iters = 3L)
res = tuneParams("classif.ksvm", task = iris.task, resampling = rdesc, par.set = ps, control = ctrl)
This will cross-validate three times to select parameters from the grid and evaluate the accuracy of the aperture dataset. You can of course change the oversampling strategies (everything else, CV-CV, CV, resampling, bootstrap and audit), the search strategy (grid search, random search, generalized simulated annealing and F-race are supported) and scores ...
source to share