svm_rbf() is a way to generate a specification of a model before fitting and allows the model to be created using different packages in R or via Spark. The main arguments for the model are:

• cost: The cost of predicting a sample within or on the wrong side of the margin.

• rbf_sigma: The precision parameter for the radial basis function.

• margin: The epsilon in the SVM insensitive loss function (regression only)

These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be set using set_engine(). If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update() can be used in lieu of recreating the object from scratch.

svm_rbf(mode = "unknown", cost = NULL, rbf_sigma = NULL, margin = NULL)

# S3 method for svm_rbf
update(
object,
parameters = NULL,
cost = NULL,
rbf_sigma = NULL,
margin = NULL,
fresh = FALSE,
...
)

## Arguments

mode A single character string for the type of model. Possible values for this model are "unknown", "regression", or "classification". A positive number for the cost of predicting a sample within or on the wrong side of the margin A positive number for radial basis function. A positive number for the epsilon in the SVM insensitive loss function (regression only) A radial basis function SVM model specification. A 1-row tibble or named list with main parameters to update. If the individual arguments are used, these will supersede the values in parameters. Also, using engine arguments in this object will result in an error. A logical for whether the arguments should be modified in-place of or replaced wholesale. Not used for update().

## Details

The model can be created using the fit() function using the following engines:

• R: "kernlab" (the default)

• R: "liquidSVM"

## Engine Details

Engines may have pre-set default arguments when executing the model fit call. For this type of model, the template of the fit calls are below:

### kernlab

svm_rbf() %&gt;%
set_engine("kernlab") %&gt;%
set_mode("regression") %&gt;%
translate()

## Radial Basis Function Support Vector Machine Specification (regression)
##
## Computational engine: kernlab
##
## Model fit template:
## kernlab::ksvm(x = missing_arg(), data = missing_arg(), kernel = "rbfdot")


svm_rbf() %&gt;%
set_engine("kernlab") %&gt;%
set_mode("classification") %&gt;%
translate()

## Radial Basis Function Support Vector Machine Specification (classification)
##
## Computational engine: kernlab
##
## Model fit template:
## kernlab::ksvm(x = missing_arg(), data = missing_arg(), kernel = "rbfdot",
##     prob.model = TRUE)


fit() passes the data directly to kernlab::ksvm() so that its formula method can create dummy variables as-needed.

### liquidSVM

svm_rbf() %&gt;%
set_engine("liquidSVM") %&gt;%
set_mode("regression") %&gt;%
translate()

## Radial Basis Function Support Vector Machine Specification (regression)
##
## Computational engine: liquidSVM
##
## Model fit template:
## liquidSVM::svm(x = missing_arg(), y = missing_arg(), folds = 1,


svm_rbf() %&gt;%
set_engine("liquidSVM") %&gt;%
set_mode("classification") %&gt;%
translate()

## Radial Basis Function Support Vector Machine Specification (classification)
##
## Computational engine: liquidSVM
##
## Model fit template:
## liquidSVM::svm(x = missing_arg(), y = missing_arg(), folds = 1,


Note that models created using the liquidSVM engine cannot be saved like conventional R objects. The fit slot of the model_fit object has to be saved separately using the liquidSVM::write.liquidSVM() function. Likewise to restore a model, the fit slot has to be replaced with the model that is read using the liquidSVM::read.liquidSVM() function.

liquidSVM parameterizes the kernel parameter differently than kernlab. To translate between engines, sigma = 1/gammas^2. Users will be specifying sigma and the function translates the value to gamma.

fit() passes the data directly to liquidSVM::svm() so that its formula method can create dummy variables as-needed.

### Parameter translations

The standardized parameter names in parsnip can be mapped to their original names in each engine that has main parameters. Each engine typically has a different default value (shown in parentheses) for each parameter.

 parsnip kernlab liquidSVM cost C (1) lambdas (varies) rbf_sigma sigma (varies) gammas (varies) margin epsilon (0.1) NA

fit()

## Examples

svm_rbf(mode = "classification", rbf_sigma = 0.2)#> Radial Basis Function Support Vector Machine Specification (classification)
#>
#> Main Arguments:
#>   rbf_sigma = 0.2
#> # Parameters can be represented by a placeholder:
svm_rbf(mode = "regression", cost = varying())#> Radial Basis Function Support Vector Machine Specification (regression)
#>
#> Main Arguments:
#>   cost = varying()
#> model <- svm_rbf(cost = 10, rbf_sigma = 0.1)
model#> Radial Basis Function Support Vector Machine Specification (unknown)
#>
#> Main Arguments:
#>   cost = 10
#>   rbf_sigma = 0.1
#> update(model, cost = 1)#> Radial Basis Function Support Vector Machine Specification (unknown)
#>
#> Main Arguments:
#>   cost = 1
#>   rbf_sigma = 0.1
#> update(model, cost = 1, fresh = TRUE)#> Radial Basis Function Support Vector Machine Specification (unknown)
#>
#> Main Arguments:
#>   cost = 1
#>