library(tidymodels)
svm_mod <- svm_rbf(mode = "regression", cost = tune()) %>%
set_engine("kernlab")
set.seed(7898)
data_folds <- vfold_cv(mtcars, v = 2)
rec <- recipe(mpg ~ ., data = mtcars) %>%
step_bs(disp, deg_free = 1)
cars_res <- tune_bayes(svm_mod, preprocessor = rec,
resamples = data_folds)
#> → 1 | warning: some 'x' values beyond boundary knots may cause ill-conditioned bases
#> There were issues with some computations 1: x15
cars_res
#> # Tuning results
#> # 2-fold cross-validation
#> # A tibble: 22 × 5
#> splits id .metrics .notes .iter
#> <list> <chr> <list> <list> <int>
#> 1 <split [16/16]> Fold1 <tibble [10 × 5]> <tibble [0 × 3]> 0
#> 2 <split [16/16]> Fold2 <tibble [10 × 5]> <tibble [5 × 3]> 0
#> 3 <split [16/16]> Fold1 <tibble [2 × 5]> <tibble [0 × 3]> 1
#> 4 <split [16/16]> Fold2 <tibble [2 × 5]> <tibble [1 × 3]> 1
#> 5 <split [16/16]> Fold1 <tibble [2 × 5]> <tibble [0 × 3]> 2
#> 6 <split [16/16]> Fold2 <tibble [2 × 5]> <tibble [1 × 3]> 2
#> 7 <split [16/16]> Fold1 <tibble [2 × 5]> <tibble [0 × 3]> 3
#> 8 <split [16/16]> Fold2 <tibble [2 × 5]> <tibble [1 × 3]> 3
#> 9 <split [16/16]> Fold1 <tibble [2 × 5]> <tibble [0 × 3]> 4
#> 10 <split [16/16]> Fold2 <tibble [2 × 5]> <tibble [1 × 3]> 4
#> # … with 12 more rows
#>
#> There were issues with some computations:
#>
#> - Warning(s) x15: some 'x' values beyond boundary knots may cause ill-conditioned b...
#>
#> Run `show_notes(.Last.tune.result)` for more information.
.Last.tune.result
#> # Tuning results
#> # 2-fold cross-validation
#> # A tibble: 2 × 4
#> splits id .metrics .notes
#> <list> <chr> <list> <list>
#> 1 <split [16/16]> Fold1 <tibble [2 × 5]> <tibble [0 × 3]>
#> 2 <split [16/16]> Fold2 <tibble [2 × 5]> <tibble [1 × 3]>
#>
#> There were issues with some computations:
#>
#> - Warning(s) x1: some 'x' values beyond boundary knots may cause ill-conditioned b...
#>
#> Run `show_notes(.Last.tune.result)` for more information.
Created on 2023-02-17 with reprex v2.0.2
Created on 2023-02-17 with reprex v2.0.2