Support vector machine

If you recall from a previous section, the first thing we did was perform RFE to reduce our input features. We'll repeat that step in the following. We'll redo our control function:

> ctrl <- caret::rfeControl(    functions = caret::lrFuncs,    method = "cv",    number = 10,    verbose = TRUE )

I say we shoot for around 20 to 30 total features and set our random seed:

> subsets <- c(20:30)> set.seed(54321)

Now, in selecting the features you can use the SVM linear or the kernel functions. Let's proceed with linear, which means our specification for the following method will be svmLinear. If, for instance, you wanted to change to a polynomial kernel, then you would specify svmPoly instead or svmRadial for the radial basis function: ...

Get Mastering Machine Learning with R - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.