.fit.svm {tidyfit}R Documentation

Support vector regression or classification for tidyfit

Description

Fits a support vector regression or classification on a 'tidyFit' R6 class. The function can be used with regress or classify.

Usage

## S3 method for class 'svm'
.fit(self, data = NULL)

Arguments

self

a 'tidyFit' R6 class.

data

a data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

Details

Hyperparameters:

Important method arguments (passed to m)

The function provides a wrapper for e1071::svm. See ?svm for more details.

Implementation

The default value for the kernel argument is set to 'linear'. If set to a different value, no coefficients will be returned.

Value

A fitted 'tidyFit' class model.

Author(s)

Johann Pfitzinger

References

Meyer D, Dimitriadou E, Hornik K, Weingessel A, Leisch F (2022). e1071: Misc Functions of the Department of Statistics, Probability Theory Group (Formerly: E1071), TU Wien. R package version 1.7-12, https://CRAN.R-project.org/package=e1071.

See Also

.fit.boost, .fit.lasso and m methods

Examples

# Load data
data <- tidyfit::Factor_Industry_Returns
data <- dplyr::filter(data, Industry == "HiTec")

# Stand-alone function
fit <- m("svm", Return ~ `Mkt-RF` + HML + SMB, data, cost = 0.1)
fit

# Within 'regress' function
fit <- regress(data, Return ~ ., m("svm", cost = 0.1),
               .mask = c("Date", "Industry"))
coef(fit)


[Package tidyfit version 0.7.1 Index]