# \donttest{
data("example_ames_knn")
# The parameters for the model:
extract_parameter_set_dials(ames_wflow)
# Summarized over resamples
collect_metrics(ames_grid_search)
# Per-resample values
collect_metrics(ames_grid_search, summarize = FALSE)
# ---------------------------------------------------------------------------
library(parsnip)
library(rsample)
library(dplyr)
library(recipes)
library(tibble)
lm_mod <- linear_reg() %>% set_engine("lm")
set.seed(93599150)
car_folds <- vfold_cv(mtcars, v = 2, repeats = 3)
ctrl <- control_resamples(save_pred = TRUE)
spline_rec <-
recipe(mpg ~ ., data = mtcars) %>%
step_ns(disp, deg_free = tune("df"))
grid <- tibble(df = 3:6)
resampled <-
lm_mod %>%
tune_grid(spline_rec, resamples = car_folds, control = ctrl, grid = grid)
collect_predictions(resampled) %>% arrange(.row)
collect_predictions(resampled, summarize = TRUE) %>% arrange(.row)
collect_predictions(resampled, summarize = TRUE, grid[1, ]) %>% arrange(.row)
# }
Run the code above in your browser using DataLab