details_svm_linear_LiblineaR: Linear support vector machines (SVMs) via LiblineaR

Description Details

Description

LiblineaR::LiblineaR() fits a support vector machine model. For classification, the model tries to maximize the width of the margin between classes. For regression, the model optimizes a robust loss function that is only affected by very large model residuals.

Details

For this engine, there are multiple modes: classification and regression

Tuning Parameters

This model has 2 tuning parameters:

This engine fits models that are L2-regularized for L2-loss. In the LiblineaR::LiblineaR() documentation, these are types 1 (classification) and 11 (regression).

Translation from parsnip to the original package (regression)

svm_linear(
  cost = double(1),
  margin = double(1)
) %>%  
  set_engine("LiblineaR") %>% 
  set_mode("regression") %>% 
  translate()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Linear Support Vector Machine Specification (regression)
## 
## Main Arguments:
##   cost = double(1)
##   margin = double(1)
## 
## Computational engine: LiblineaR 
## 
## Model fit template:
## LiblineaR::LiblineaR(x = missing_arg(), y = missing_arg(), wi = missing_arg(), 
##     C = double(1), svr_eps = double(1), type = 11)

Translation from parsnip to the original package (classification)

svm_linear(
  cost = double(1)
) %>% 
  set_engine("LiblineaR") %>% 
  set_mode("classification") %>% 
  translate()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Linear Support Vector Machine Specification (classification)
## 
## Main Arguments:
##   cost = double(1)
## 
## Computational engine: LiblineaR 
## 
## Model fit template:
## LiblineaR::LiblineaR(x = missing_arg(), y = missing_arg(), wi = missing_arg(), 
##     C = double(1), type = 1)

The margin parameter does not apply to classification models.

Note that the LiblineaR engine does not produce class probabilities. When optimizing the model using the tune package, the default metrics require class probabilities. To use the tune_*() functions, a metric set must be passed as an argument that only contains metrics for hard class predictions (e.g., accuracy).

Preprocessing requirements

Factor/categorical predictors need to be converted to numeric values (e.g., dummy or indicator variables) for this engine. When using the formula method via fit.model_spec(), parsnip will convert factor columns to indicators.

Predictors should have the same scale. One way to achieve this is to center and scale each so that each predictor has mean zero and a variance of one.

Examples

The “Fitting and Predicting with parsnip” article contains examples for svm_linear() with the "LiblineaR" engine.

References


parsnip documentation built on July 21, 2021, 5:08 p.m.