Skip to contents

A wrapper for e1071::svm() with probability = TRUE for use in nadir::super_learner() with binary outcomes.

Usage

lnr_svm_binary(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 for the probability of the outcome being 1/TRUE (a numeric vector of values, one for each row of newdata).

Details

Predicted probabilities are obtained via Platt scaling (see ?e1071::svm) and returned for the outcome being 1/TRUE.

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

See also

binary_learners

Examples

lnr_svm_binary(mtcars, am ~ hp + mpg)(mtcars)
#>  [1] 0.3973686 0.3973686 0.5756576 0.4320504 0.2309534 0.2335767 0.2877874
#>  [8] 0.6997708 0.5743921 0.2615793 0.2061255 0.1680978 0.1870346 0.1551129
#> [15] 0.2153665 0.2223718 0.2309882 0.8558026 0.8548446 0.8328821 0.4539089
#> [22] 0.1576545 0.1571042 0.2757713 0.2538478 0.8328821 0.7986646 0.8586909
#> [29] 0.4409029 0.2799967 0.7981346 0.4330622