| tune | R Documentation |
Hyperparameter tuning via grid or random search.
tune(
data,
formula,
model,
grid,
resampling = cv(5),
metric = NULL,
type = NULL,
search = c("grid", "random"),
n_evals = NULL,
outer_resampling = NULL,
seed = NULL,
ncores = NULL,
...
)
data |
Data frame. |
formula |
Model formula. |
model |
Learner id. |
grid |
Data frame of hyperparameter combinations. |
resampling |
Resampling object. |
metric |
Metric to optimize. |
type |
Prediction type override. |
search |
Search strategy: |
n_evals |
Maximum number of configurations to evaluate when
|
outer_resampling |
Optional outer resampling object. When supplied,
|
seed |
Optional seed. |
ncores |
Optional number of CPU cores used for tuning tasks. |
... |
Passed to |
A funcml_tune object.
tune_obj <- tune(
data = mtcars,
formula = mpg ~ wt + hp,
model = "rpart",
grid = expand.grid(cp = c(0.001, 0.01), minsplit = c(5, 10)),
resampling = cv(3, seed = 1),
metric = "rmse"
)
tune_obj$best
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.