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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.