Skip to contents

A wrapper for e1071::svm() for use in nadir::super_learner(), performing support vector (eps-)regression.

Usage

lnr_svm(data, formula, ...)

Arguments

data

A dataframe to train a learner / learners on.

formula

A regression formula to use inside this learner.

...

Any extra arguments that should be passed to the internal model for model fitting purposes.

Value

A prediction function that accepts newdata, which returns predictions (a numeric vector of values, one for each row of newdata).

Details

Support vector regression fits a function in a kernel-induced feature space (radial basis by default) that is at most \(\varepsilon\) away from the observed outcomes wherever possible, yielding a flexible, margin-based regression paradigm not otherwise represented in the built-in learners. Kernel choice and hyperparameters (e.g., kernel, cost, gamma, epsilon) may be passed through ....

Note that e1071::svm() does not support observation weights, so no weights argument is accepted here.

See also

learners

Examples

lnr_svm(mtcars, mpg ~ hp + disp + wt)(mtcars)
#>  [1] 21.60407 20.69242 25.23508 18.52117 17.23762 18.70372 14.90224 23.05669
#>  [9] 21.24426 18.60017 18.60017 15.79535 15.84625 15.82269 14.01861 13.99604
#> [17] 14.09739 27.64862 29.52091 28.95888 24.06043 17.15489 17.06006 14.41405
#> [25] 17.24091 28.56741 25.83483 27.33439 15.41810 19.09685 15.60081 22.00211
lnr_svm(mtcars, mpg ~ ., kernel = "polynomial", cost = 2)(mtcars)
#>  [1] 20.39481 20.16549 24.95103 19.45456 18.09482 18.70050 13.69787 22.54807
#>  [9] 23.40293 19.28172 19.20349 16.25434 16.87338 16.92327 11.00378 10.78793
#> [17] 11.69800 28.21412 31.00466 30.93861 22.10079 16.82692 18.06120 13.90112
#> [25] 17.50718 27.90337 26.58999 29.79839 16.40331 20.30454 14.39988 23.37523