Tunes the model according to the tuning grid, workflow, and data split specified.

tuneGrid(wflow, data_split, grid = buildTuningGrid(model = "LR"), n_fold = 5)

Arguments

wflow

A workflow object, such as the output of buildWflow()

data_split

An rsplit object, such as the output of splitMLInputTibble().

grid

A tuning grid as a tibble, such as the output of buildTuningGrid()

n_fold

num Number of folds of cross-validation

Value

Results of grid tuning

Examples

data(demo_ml_tibble)
data_split <- splitMLInputTibble(demo_ml_tibble, split = c(1, 0), seed = 1)
wflow <- buildWflow(
  buildLRModel(),
  buildRecipe(rsample::training(data_split))
)
grid <- buildTuningGrid("LR", 10^c(-3, -1), c(0, 0.5, 1))
set.seed(1)
tuneGrid(wflow, data_split, grid, n_fold = 2)
#> # Tuning results
#> # 2-fold cross-validation using stratification 
#> # A tibble: 2 × 5
#>   splits          id    .metrics          .notes           .predictions      
#>   <list>          <chr> <list>            <list>           <list>            
#> 1 <split [24/24]> Fold1 <tibble [36 × 6]> <tibble [0 × 4]> <tibble [144 × 8]>
#> 2 <split [24/24]> Fold2 <tibble [36 × 6]> <tibble [0 × 4]> <tibble [144 × 8]>