Immanuel
2011-May-28 17:04 UTC
[R] how to train ksvm with spectral kernel (kernlab) in caret?
Hello all, I would like to use the train function from the caret package to train a svm with a spectral kernel from the kernlab package. Sadly a svm with spectral kernel is not among the many methods in caret... using caret to train svmRadial: ------------------ library(caret) library(kernlab) data(iris) TrainData<- iris[,1:4] TrainClasses<- iris[,5] set.seed(2) fitControl$summaryFunction<- Rand svmNew<- train(TrainData, TrainClasses, method = "svmRadial", preProcess = c("center", "scale"), metric = "cRand", tuneLength = 4) svmNew ------------------- here is an example on how to train the ksvm with spectral kernel ------------------- # Load the data data(reuters) y <- rlabels x <- reuters sk <- stringdot(type="spectrum", length=4, normalized=TRUE) svp <- ksvm(x,y,kernel=sk,scale=c(),cross=5) svp ----------------- Does anyone know how I can train the svm from above with using the caret package? best regards [[alternative HTML version deleted]]