#| child: aaa.Rmd
#| include: false

r descr_models("svm_rbf", "kernlab")

Tuning Parameters

#| label: kernlab-param-info
#| echo: false
defaults <- 
  tibble::tibble(parsnip = c("cost","rbf_sigma", "margin"),
                 default = c("1.0", "see below", "0.1"))

param <-
  svm_rbf() |> 
  set_engine("kernlab") |> 
  make_parameter_list(defaults)

This model has r nrow(param) tuning parameters:

#| label: kernlab-param-list
#| echo: false
#| results: asis
param$item

There is no default for the radial basis function kernel parameter. kernlab estimates it from the data using a heuristic method. See [kernlab::sigest()]. This method uses random numbers so, without setting the seed before fitting, the model will not be reproducible.

Parsnip changes the default range for cost to c(-10, 5).

Translation from parsnip to the original package (regression)

#| label: kernlab-reg
svm_rbf(
  cost = double(1),
  rbf_sigma = double(1), 
  margin = double(1)
) |>  
  set_engine("kernlab") |> 
  set_mode("regression") |> 
  translate()

Translation from parsnip to the original package (classification)

#| label: kernlab-cls
svm_rbf(
  cost = double(1),
  rbf_sigma = double(1)
) |> 
  set_engine("kernlab") |> 
  set_mode("classification") |> 
  translate()

The margin parameter does not apply to classification models.

Note that the "kernlab" engine does not naturally estimate class probabilities. To produce them, the decision values of the model are converted to probabilities using Platt scaling. This method fits an additional model on top of the SVM model. When fitting the Platt scaling model, random numbers are used that are not reproducible or controlled by R's random number stream.

Preprocessing requirements

#| child: template-makes-dummies.Rmd
#| child: template-same-scale.Rmd

Case weights

#| child: template-no-case-weights.Rmd

Saving fitted model objects

#| child: template-butcher.Rmd

Examples

The "Fitting and Predicting with parsnip" article contains examples for svm_rbf() with the "kernlab" engine.

References



Try the parsnip package in your browser

Any scripts or data that you put into this service are public.

parsnip documentation built on June 8, 2025, 12:10 p.m.