Create a Tune Grid Specific to the Provided Model Spec
set_r_grid.Rd
The hyper parameter grid can either be provided with this function or all at
once later on with rpwf_augment()
Arguments
- obj
a model spec object generated by
parsnip::set_engine()
andparsnip::set_mode()
.- grid_fun
a
dials::grid_<functions>
, e.g.,grid_random()
,grid_latin_hypercube()
.- hyper_par_fun
update dials functions such as
dials::penalty()
anddials::cost()
with a named list. See examples.- ...
arguments to pass to
grid_fun
.
Examples
m <- parsnip::boost_tree() |>
parsnip::set_engine("xgboost") |>
parsnip::set_mode("classification") |>
set_r_grid(dials::grid_random, list(trees = dials::trees(range = c(2, 3))), size = 5)
m$grid_fun
#> function (x, ..., size = 5, original = TRUE, filter = NULL)
#> {
#> dots <- list(...)
#> if (any(names(dots) == "levels")) {
#> rlang::warn("`levels` is not an argument to `grid_random()`. Did you mean `size`?")
#> }
#> UseMethod("grid_random")
#> }
#> <bytecode: 0x563c732f81a0>
#> <environment: namespace:dials>
m$grid_fun_args
#> $size
#> [1] 5
#>