1
$\begingroup$

I would like to use the tune() function in R to specify the hyperparameters in an SVM model. The particular SVM implementation that I am using is the one that is provided in the e1071 package.

By default, tune() runs a K-fold cross-validation, and chooses the testing and training sets for each fold by itself. I am wondering whether I can override this behavior and specify the indices of the testing and training set for each fold myself.

If not, does anyone know if there is a package or combination of packages which allows me to run a K-fold CV on SVM and specify the indices of the training and testing set.

$\endgroup$
2
$\begingroup$

The caret package allows you to specify the training and testing indexes for each fold/resample, using the indexes and indexesOut arguments of the trainControl argument for train.

By default, caret uses kernlab for svms, but you can use the custom argument for trainControl to specify any predictive modeling function you wish.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.