Tidymodels - 如何在控件中正确使用 verbose = TRUE = control_grid
Tidymodels - How to correctly use verbose = TRUE in control = control_grid
我正在尝试使用 verbose = TRUE 查看调整网格的进度。
它似乎对我不起作用,是我放错地方了还是我使用不当?底部是我想要的屏幕截图,下面是没有所需输出的可重现代码。
library(tidyverse)
library(tidymodels)
options(tidymodels.dark = TRUE)
parks <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-06-22/parks.csv')
modeling_df <- parks %>%
select(pct_near_park_data, spend_per_resident_data, med_park_size_data) %>%
rename(nearness = "pct_near_park_data",
spending = "spend_per_resident_data",
acres = "med_park_size_data") %>%
mutate(nearness = (parse_number(nearness)/100)) %>%
mutate(spending = parse_number(spending))
set.seed(123)
park_split <- initial_split(modeling_df)
park_train <- training(park_split)
park_test <- testing(park_split)
tree_rec <- recipe(nearness ~., data = park_train)
tree_prep <- prep(tree_rec)
juiced <- juice(tree_prep)
tune_spec <- rand_forest(
mtry = tune(),
trees = 1000,
min_n = tune()
) %>%
set_mode("regression") %>%
set_engine("ranger")
tune_wf <- workflow() %>%
add_recipe(tree_rec) %>%
add_model(tune_spec)
set.seed(234)
park_folds <- vfold_cv(park_train)
set.seed(345)
tune_res <- tune_grid(
tune_wf,
resamples = park_folds,
grid = 20,
control = control_grid(verbose = TRUE)
)
# Results of running the code
> tune_res <- tune_grid(
+ tune_wf,
+ resamples = park_folds,
+ grid = 20,
+ control = control_grid(verbose = TRUE)
+ )
i Creating pre-processing data to finalize unknown parameter: mtry
这是我希望它看起来像的示例
您能否使用 reprex 制作您的示例以确保您 运行 这是在一个新的会话中并且没有加载可能干扰您的选项的其他包?
这是我从您的示例代码中得到的结果:
library(tidyverse)
library(tidymodels)
#> Registered S3 method overwritten by 'tune':
#> method from
#> required_pkgs.model_spec parsnip
options(tidymodels.dark = TRUE)
parks <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-06-22/parks.csv')
#>
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#> .default = col_double(),
#> city = col_character(),
#> park_pct_city_data = col_character(),
#> pct_near_park_data = col_character(),
#> spend_per_resident_data = col_character(),
#> city_dup = col_character()
#> )
#> ℹ Use `spec()` for the full column specifications.
modeling_df <- parks %>%
select(pct_near_park_data, spend_per_resident_data, med_park_size_data) %>%
rename(nearness = "pct_near_park_data",
spending = "spend_per_resident_data",
acres = "med_park_size_data") %>%
mutate(nearness = (parse_number(nearness)/100)) %>%
mutate(spending = parse_number(spending))
set.seed(123)
park_split <- initial_split(modeling_df)
park_train <- training(park_split)
park_test <- testing(park_split)
tree_rec <- recipe(nearness ~., data = park_train)
tree_prep <- prep(tree_rec)
juiced <- juice(tree_prep)
tune_spec <- rand_forest(
mtry = tune(),
trees = 1000,
min_n = tune()
) %>%
set_mode("regression") %>%
set_engine("ranger")
tune_wf <- workflow() %>%
add_recipe(tree_rec) %>%
add_model(tune_spec)
set.seed(234)
park_folds <- vfold_cv(park_train, v = 5)
set.seed(345)
tune_res <- tune_grid(
tune_wf,
resamples = park_folds,
grid = 20,
control = control_grid(verbose = TRUE)
)
#> i Creating pre-processing data to finalize unknown parameter: mtry
#> i Fold1: preprocessor 1/1
#> ✓ Fold1: preprocessor 1/1
#> i Fold1: preprocessor 1/1, model 1/20
#> ✓ Fold1: preprocessor 1/1, model 1/20
#> i Fold1: preprocessor 1/1, model 1/20 (predictions)
#> i Fold1: preprocessor 1/1, model 2/20
#> ✓ Fold1: preprocessor 1/1, model 2/20
#> i Fold1: preprocessor 1/1, model 2/20 (predictions)
#> i Fold1: preprocessor 1/1, model 3/20
#> ✓ Fold1: preprocessor 1/1, model 3/20
#> i Fold1: preprocessor 1/1, model 3/20 (predictions)
#> i Fold1: preprocessor 1/1, model 4/20
#> ✓ Fold1: preprocessor 1/1, model 4/20
#> i Fold1: preprocessor 1/1, model 4/20 (predictions)
#> i Fold1: preprocessor 1/1, model 5/20
#> ✓ Fold1: preprocessor 1/1, model 5/20
#> i Fold1: preprocessor 1/1, model 5/20 (predictions)
#> i Fold1: preprocessor 1/1, model 6/20
#> ✓ Fold1: preprocessor 1/1, model 6/20
#> i Fold1: preprocessor 1/1, model 6/20 (predictions)
#> i Fold1: preprocessor 1/1, model 7/20
#> ✓ Fold1: preprocessor 1/1, model 7/20
#> i Fold1: preprocessor 1/1, model 7/20 (predictions)
#> i Fold1: preprocessor 1/1, model 8/20
#> ✓ Fold1: preprocessor 1/1, model 8/20
#> i Fold1: preprocessor 1/1, model 8/20 (predictions)
#> i Fold1: preprocessor 1/1, model 9/20
#> ✓ Fold1: preprocessor 1/1, model 9/20
#> i Fold1: preprocessor 1/1, model 9/20 (predictions)
#> i Fold1: preprocessor 1/1, model 10/20
#> ✓ Fold1: preprocessor 1/1, model 10/20
#> i Fold1: preprocessor 1/1, model 10/20 (predictions)
#> i Fold1: preprocessor 1/1, model 11/20
#> ✓ Fold1: preprocessor 1/1, model 11/20
#> i Fold1: preprocessor 1/1, model 11/20 (predictions)
#> i Fold1: preprocessor 1/1, model 12/20
#> ✓ Fold1: preprocessor 1/1, model 12/20
#> i Fold1: preprocessor 1/1, model 12/20 (predictions)
#> i Fold1: preprocessor 1/1, model 13/20
#> ✓ Fold1: preprocessor 1/1, model 13/20
#> i Fold1: preprocessor 1/1, model 13/20 (predictions)
#> i Fold1: preprocessor 1/1, model 14/20
#> ✓ Fold1: preprocessor 1/1, model 14/20
#> i Fold1: preprocessor 1/1, model 14/20 (predictions)
#> i Fold1: preprocessor 1/1, model 15/20
#> ✓ Fold1: preprocessor 1/1, model 15/20
#> i Fold1: preprocessor 1/1, model 15/20 (predictions)
#> i Fold1: preprocessor 1/1, model 16/20
#> ✓ Fold1: preprocessor 1/1, model 16/20
#> i Fold1: preprocessor 1/1, model 16/20 (predictions)
#> i Fold1: preprocessor 1/1, model 17/20
#> ✓ Fold1: preprocessor 1/1, model 17/20
#> i Fold1: preprocessor 1/1, model 17/20 (predictions)
#> i Fold1: preprocessor 1/1, model 18/20
#> ✓ Fold1: preprocessor 1/1, model 18/20
#> i Fold1: preprocessor 1/1, model 18/20 (predictions)
#> i Fold1: preprocessor 1/1, model 19/20
#> ✓ Fold1: preprocessor 1/1, model 19/20
#> i Fold1: preprocessor 1/1, model 19/20 (predictions)
#> i Fold1: preprocessor 1/1, model 20/20
#> ✓ Fold1: preprocessor 1/1, model 20/20
#> i Fold1: preprocessor 1/1, model 20/20 (predictions)
#> i Fold2: preprocessor 1/1
#> ✓ Fold2: preprocessor 1/1
#> i Fold2: preprocessor 1/1, model 1/20
#> ✓ Fold2: preprocessor 1/1, model 1/20
#> i Fold2: preprocessor 1/1, model 1/20 (predictions)
#> i Fold2: preprocessor 1/1, model 2/20
#> ✓ Fold2: preprocessor 1/1, model 2/20
#> i Fold2: preprocessor 1/1, model 2/20 (predictions)
#> i Fold2: preprocessor 1/1, model 3/20
#> ✓ Fold2: preprocessor 1/1, model 3/20
#> i Fold2: preprocessor 1/1, model 3/20 (predictions)
#> i Fold2: preprocessor 1/1, model 4/20
#> ✓ Fold2: preprocessor 1/1, model 4/20
#> i Fold2: preprocessor 1/1, model 4/20 (predictions)
#> i Fold2: preprocessor 1/1, model 5/20
#> ✓ Fold2: preprocessor 1/1, model 5/20
#> i Fold2: preprocessor 1/1, model 5/20 (predictions)
#> i Fold2: preprocessor 1/1, model 6/20
#> ✓ Fold2: preprocessor 1/1, model 6/20
#> i Fold2: preprocessor 1/1, model 6/20 (predictions)
#> i Fold2: preprocessor 1/1, model 7/20
#> ✓ Fold2: preprocessor 1/1, model 7/20
#> i Fold2: preprocessor 1/1, model 7/20 (predictions)
#> i Fold2: preprocessor 1/1, model 8/20
#> ✓ Fold2: preprocessor 1/1, model 8/20
#> i Fold2: preprocessor 1/1, model 8/20 (predictions)
#> i Fold2: preprocessor 1/1, model 9/20
#> ✓ Fold2: preprocessor 1/1, model 9/20
#> i Fold2: preprocessor 1/1, model 9/20 (predictions)
#> i Fold2: preprocessor 1/1, model 10/20
#> ✓ Fold2: preprocessor 1/1, model 10/20
#> i Fold2: preprocessor 1/1, model 10/20 (predictions)
#> i Fold2: preprocessor 1/1, model 11/20
#> ✓ Fold2: preprocessor 1/1, model 11/20
#> i Fold2: preprocessor 1/1, model 11/20 (predictions)
#> i Fold2: preprocessor 1/1, model 12/20
#> ✓ Fold2: preprocessor 1/1, model 12/20
#> i Fold2: preprocessor 1/1, model 12/20 (predictions)
#> i Fold2: preprocessor 1/1, model 13/20
#> ✓ Fold2: preprocessor 1/1, model 13/20
#> i Fold2: preprocessor 1/1, model 13/20 (predictions)
#> i Fold2: preprocessor 1/1, model 14/20
#> ✓ Fold2: preprocessor 1/1, model 14/20
#> i Fold2: preprocessor 1/1, model 14/20 (predictions)
#> i Fold2: preprocessor 1/1, model 15/20
#> ✓ Fold2: preprocessor 1/1, model 15/20
#> i Fold2: preprocessor 1/1, model 15/20 (predictions)
#> i Fold2: preprocessor 1/1, model 16/20
#> ✓ Fold2: preprocessor 1/1, model 16/20
#> i Fold2: preprocessor 1/1, model 16/20 (predictions)
#> i Fold2: preprocessor 1/1, model 17/20
#> ✓ Fold2: preprocessor 1/1, model 17/20
#> i Fold2: preprocessor 1/1, model 17/20 (predictions)
#> i Fold2: preprocessor 1/1, model 18/20
#> ✓ Fold2: preprocessor 1/1, model 18/20
#> i Fold2: preprocessor 1/1, model 18/20 (predictions)
#> i Fold2: preprocessor 1/1, model 19/20
#> ✓ Fold2: preprocessor 1/1, model 19/20
#> i Fold2: preprocessor 1/1, model 19/20 (predictions)
#> i Fold2: preprocessor 1/1, model 20/20
#> ✓ Fold2: preprocessor 1/1, model 20/20
#> i Fold2: preprocessor 1/1, model 20/20 (predictions)
#> i Fold3: preprocessor 1/1
#> ✓ Fold3: preprocessor 1/1
#> i Fold3: preprocessor 1/1, model 1/20
#> ✓ Fold3: preprocessor 1/1, model 1/20
#> i Fold3: preprocessor 1/1, model 1/20 (predictions)
#> i Fold3: preprocessor 1/1, model 2/20
#> ✓ Fold3: preprocessor 1/1, model 2/20
#> i Fold3: preprocessor 1/1, model 2/20 (predictions)
#> i Fold3: preprocessor 1/1, model 3/20
#> ✓ Fold3: preprocessor 1/1, model 3/20
#> i Fold3: preprocessor 1/1, model 3/20 (predictions)
#> i Fold3: preprocessor 1/1, model 4/20
#> ✓ Fold3: preprocessor 1/1, model 4/20
#> i Fold3: preprocessor 1/1, model 4/20 (predictions)
#> i Fold3: preprocessor 1/1, model 5/20
#> ✓ Fold3: preprocessor 1/1, model 5/20
#> i Fold3: preprocessor 1/1, model 5/20 (predictions)
#> i Fold3: preprocessor 1/1, model 6/20
#> ✓ Fold3: preprocessor 1/1, model 6/20
#> i Fold3: preprocessor 1/1, model 6/20 (predictions)
#> i Fold3: preprocessor 1/1, model 7/20
#> ✓ Fold3: preprocessor 1/1, model 7/20
#> i Fold3: preprocessor 1/1, model 7/20 (predictions)
#> i Fold3: preprocessor 1/1, model 8/20
#> ✓ Fold3: preprocessor 1/1, model 8/20
#> i Fold3: preprocessor 1/1, model 8/20 (predictions)
#> i Fold3: preprocessor 1/1, model 9/20
#> ✓ Fold3: preprocessor 1/1, model 9/20
#> i Fold3: preprocessor 1/1, model 9/20 (predictions)
#> i Fold3: preprocessor 1/1, model 10/20
#> ✓ Fold3: preprocessor 1/1, model 10/20
#> i Fold3: preprocessor 1/1, model 10/20 (predictions)
#> i Fold3: preprocessor 1/1, model 11/20
#> ✓ Fold3: preprocessor 1/1, model 11/20
#> i Fold3: preprocessor 1/1, model 11/20 (predictions)
#> i Fold3: preprocessor 1/1, model 12/20
#> ✓ Fold3: preprocessor 1/1, model 12/20
#> i Fold3: preprocessor 1/1, model 12/20 (predictions)
#> i Fold3: preprocessor 1/1, model 13/20
#> ✓ Fold3: preprocessor 1/1, model 13/20
#> i Fold3: preprocessor 1/1, model 13/20 (predictions)
#> i Fold3: preprocessor 1/1, model 14/20
#> ✓ Fold3: preprocessor 1/1, model 14/20
#> i Fold3: preprocessor 1/1, model 14/20 (predictions)
#> i Fold3: preprocessor 1/1, model 15/20
#> ✓ Fold3: preprocessor 1/1, model 15/20
#> i Fold3: preprocessor 1/1, model 15/20 (predictions)
#> i Fold3: preprocessor 1/1, model 16/20
#> ✓ Fold3: preprocessor 1/1, model 16/20
#> i Fold3: preprocessor 1/1, model 16/20 (predictions)
#> i Fold3: preprocessor 1/1, model 17/20
#> ✓ Fold3: preprocessor 1/1, model 17/20
#> i Fold3: preprocessor 1/1, model 17/20 (predictions)
#> i Fold3: preprocessor 1/1, model 18/20
#> ✓ Fold3: preprocessor 1/1, model 18/20
#> i Fold3: preprocessor 1/1, model 18/20 (predictions)
#> i Fold3: preprocessor 1/1, model 19/20
#> ✓ Fold3: preprocessor 1/1, model 19/20
#> i Fold3: preprocessor 1/1, model 19/20 (predictions)
#> i Fold3: preprocessor 1/1, model 20/20
#> ✓ Fold3: preprocessor 1/1, model 20/20
#> i Fold3: preprocessor 1/1, model 20/20 (predictions)
#> i Fold4: preprocessor 1/1
#> ✓ Fold4: preprocessor 1/1
#> i Fold4: preprocessor 1/1, model 1/20
#> ✓ Fold4: preprocessor 1/1, model 1/20
#> i Fold4: preprocessor 1/1, model 1/20 (predictions)
#> i Fold4: preprocessor 1/1, model 2/20
#> ✓ Fold4: preprocessor 1/1, model 2/20
#> i Fold4: preprocessor 1/1, model 2/20 (predictions)
#> i Fold4: preprocessor 1/1, model 3/20
#> ✓ Fold4: preprocessor 1/1, model 3/20
#> i Fold4: preprocessor 1/1, model 3/20 (predictions)
#> i Fold4: preprocessor 1/1, model 4/20
#> ✓ Fold4: preprocessor 1/1, model 4/20
#> i Fold4: preprocessor 1/1, model 4/20 (predictions)
#> i Fold4: preprocessor 1/1, model 5/20
#> ✓ Fold4: preprocessor 1/1, model 5/20
#> i Fold4: preprocessor 1/1, model 5/20 (predictions)
#> i Fold4: preprocessor 1/1, model 6/20
#> ✓ Fold4: preprocessor 1/1, model 6/20
#> i Fold4: preprocessor 1/1, model 6/20 (predictions)
#> i Fold4: preprocessor 1/1, model 7/20
#> ✓ Fold4: preprocessor 1/1, model 7/20
#> i Fold4: preprocessor 1/1, model 7/20 (predictions)
#> i Fold4: preprocessor 1/1, model 8/20
#> ✓ Fold4: preprocessor 1/1, model 8/20
#> i Fold4: preprocessor 1/1, model 8/20 (predictions)
#> i Fold4: preprocessor 1/1, model 9/20
#> ✓ Fold4: preprocessor 1/1, model 9/20
#> i Fold4: preprocessor 1/1, model 9/20 (predictions)
#> i Fold4: preprocessor 1/1, model 10/20
#> ✓ Fold4: preprocessor 1/1, model 10/20
#> i Fold4: preprocessor 1/1, model 10/20 (predictions)
#> i Fold4: preprocessor 1/1, model 11/20
#> ✓ Fold4: preprocessor 1/1, model 11/20
#> i Fold4: preprocessor 1/1, model 11/20 (predictions)
#> i Fold4: preprocessor 1/1, model 12/20
#> ✓ Fold4: preprocessor 1/1, model 12/20
#> i Fold4: preprocessor 1/1, model 12/20 (predictions)
#> i Fold4: preprocessor 1/1, model 13/20
#> ✓ Fold4: preprocessor 1/1, model 13/20
#> i Fold4: preprocessor 1/1, model 13/20 (predictions)
#> i Fold4: preprocessor 1/1, model 14/20
#> ✓ Fold4: preprocessor 1/1, model 14/20
#> i Fold4: preprocessor 1/1, model 14/20 (predictions)
#> i Fold4: preprocessor 1/1, model 15/20
#> ✓ Fold4: preprocessor 1/1, model 15/20
#> i Fold4: preprocessor 1/1, model 15/20 (predictions)
#> i Fold4: preprocessor 1/1, model 16/20
#> ✓ Fold4: preprocessor 1/1, model 16/20
#> i Fold4: preprocessor 1/1, model 16/20 (predictions)
#> i Fold4: preprocessor 1/1, model 17/20
#> ✓ Fold4: preprocessor 1/1, model 17/20
#> i Fold4: preprocessor 1/1, model 17/20 (predictions)
#> i Fold4: preprocessor 1/1, model 18/20
#> ✓ Fold4: preprocessor 1/1, model 18/20
#> i Fold4: preprocessor 1/1, model 18/20 (predictions)
#> i Fold4: preprocessor 1/1, model 19/20
#> ✓ Fold4: preprocessor 1/1, model 19/20
#> i Fold4: preprocessor 1/1, model 19/20 (predictions)
#> i Fold4: preprocessor 1/1, model 20/20
#> ✓ Fold4: preprocessor 1/1, model 20/20
#> i Fold4: preprocessor 1/1, model 20/20 (predictions)
#> i Fold5: preprocessor 1/1
#> ✓ Fold5: preprocessor 1/1
#> i Fold5: preprocessor 1/1, model 1/20
#> ✓ Fold5: preprocessor 1/1, model 1/20
#> i Fold5: preprocessor 1/1, model 1/20 (predictions)
#> i Fold5: preprocessor 1/1, model 2/20
#> ✓ Fold5: preprocessor 1/1, model 2/20
#> i Fold5: preprocessor 1/1, model 2/20 (predictions)
#> i Fold5: preprocessor 1/1, model 3/20
#> ✓ Fold5: preprocessor 1/1, model 3/20
#> i Fold5: preprocessor 1/1, model 3/20 (predictions)
#> i Fold5: preprocessor 1/1, model 4/20
#> ✓ Fold5: preprocessor 1/1, model 4/20
#> i Fold5: preprocessor 1/1, model 4/20 (predictions)
#> i Fold5: preprocessor 1/1, model 5/20
#> ✓ Fold5: preprocessor 1/1, model 5/20
#> i Fold5: preprocessor 1/1, model 5/20 (predictions)
#> i Fold5: preprocessor 1/1, model 6/20
#> ✓ Fold5: preprocessor 1/1, model 6/20
#> i Fold5: preprocessor 1/1, model 6/20 (predictions)
#> i Fold5: preprocessor 1/1, model 7/20
#> ✓ Fold5: preprocessor 1/1, model 7/20
#> i Fold5: preprocessor 1/1, model 7/20 (predictions)
#> i Fold5: preprocessor 1/1, model 8/20
#> ✓ Fold5: preprocessor 1/1, model 8/20
#> i Fold5: preprocessor 1/1, model 8/20 (predictions)
#> i Fold5: preprocessor 1/1, model 9/20
#> ✓ Fold5: preprocessor 1/1, model 9/20
#> i Fold5: preprocessor 1/1, model 9/20 (predictions)
#> i Fold5: preprocessor 1/1, model 10/20
#> ✓ Fold5: preprocessor 1/1, model 10/20
#> i Fold5: preprocessor 1/1, model 10/20 (predictions)
#> i Fold5: preprocessor 1/1, model 11/20
#> ✓ Fold5: preprocessor 1/1, model 11/20
#> i Fold5: preprocessor 1/1, model 11/20 (predictions)
#> i Fold5: preprocessor 1/1, model 12/20
#> ✓ Fold5: preprocessor 1/1, model 12/20
#> i Fold5: preprocessor 1/1, model 12/20 (predictions)
#> i Fold5: preprocessor 1/1, model 13/20
#> ✓ Fold5: preprocessor 1/1, model 13/20
#> i Fold5: preprocessor 1/1, model 13/20 (predictions)
#> i Fold5: preprocessor 1/1, model 14/20
#> ✓ Fold5: preprocessor 1/1, model 14/20
#> i Fold5: preprocessor 1/1, model 14/20 (predictions)
#> i Fold5: preprocessor 1/1, model 15/20
#> ✓ Fold5: preprocessor 1/1, model 15/20
#> i Fold5: preprocessor 1/1, model 15/20 (predictions)
#> i Fold5: preprocessor 1/1, model 16/20
#> ✓ Fold5: preprocessor 1/1, model 16/20
#> i Fold5: preprocessor 1/1, model 16/20 (predictions)
#> i Fold5: preprocessor 1/1, model 17/20
#> ✓ Fold5: preprocessor 1/1, model 17/20
#> i Fold5: preprocessor 1/1, model 17/20 (predictions)
#> i Fold5: preprocessor 1/1, model 18/20
#> ✓ Fold5: preprocessor 1/1, model 18/20
#> i Fold5: preprocessor 1/1, model 18/20 (predictions)
#> i Fold5: preprocessor 1/1, model 19/20
#> ✓ Fold5: preprocessor 1/1, model 19/20
#> i Fold5: preprocessor 1/1, model 19/20 (predictions)
#> i Fold5: preprocessor 1/1, model 20/20
#> ✓ Fold5: preprocessor 1/1, model 20/20
#> i Fold5: preprocessor 1/1, model 20/20 (predictions)
由 reprex package (v2.0.0)
于 2021-06-27 创建
我确实看到了详细的输出。
我怀疑您可能在某个时候打开了并行处理,这会关闭 return 详细日志记录的能力。目前无法使用我们支持的并行后端从工作人员收集日志记录。
我正在尝试使用 verbose = TRUE 查看调整网格的进度。 它似乎对我不起作用,是我放错地方了还是我使用不当?底部是我想要的屏幕截图,下面是没有所需输出的可重现代码。
library(tidyverse)
library(tidymodels)
options(tidymodels.dark = TRUE)
parks <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-06-22/parks.csv')
modeling_df <- parks %>%
select(pct_near_park_data, spend_per_resident_data, med_park_size_data) %>%
rename(nearness = "pct_near_park_data",
spending = "spend_per_resident_data",
acres = "med_park_size_data") %>%
mutate(nearness = (parse_number(nearness)/100)) %>%
mutate(spending = parse_number(spending))
set.seed(123)
park_split <- initial_split(modeling_df)
park_train <- training(park_split)
park_test <- testing(park_split)
tree_rec <- recipe(nearness ~., data = park_train)
tree_prep <- prep(tree_rec)
juiced <- juice(tree_prep)
tune_spec <- rand_forest(
mtry = tune(),
trees = 1000,
min_n = tune()
) %>%
set_mode("regression") %>%
set_engine("ranger")
tune_wf <- workflow() %>%
add_recipe(tree_rec) %>%
add_model(tune_spec)
set.seed(234)
park_folds <- vfold_cv(park_train)
set.seed(345)
tune_res <- tune_grid(
tune_wf,
resamples = park_folds,
grid = 20,
control = control_grid(verbose = TRUE)
)
# Results of running the code
> tune_res <- tune_grid(
+ tune_wf,
+ resamples = park_folds,
+ grid = 20,
+ control = control_grid(verbose = TRUE)
+ )
i Creating pre-processing data to finalize unknown parameter: mtry
这是我希望它看起来像的示例
您能否使用 reprex 制作您的示例以确保您 运行 这是在一个新的会话中并且没有加载可能干扰您的选项的其他包?
这是我从您的示例代码中得到的结果:
library(tidyverse)
library(tidymodels)
#> Registered S3 method overwritten by 'tune':
#> method from
#> required_pkgs.model_spec parsnip
options(tidymodels.dark = TRUE)
parks <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-06-22/parks.csv')
#>
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#> .default = col_double(),
#> city = col_character(),
#> park_pct_city_data = col_character(),
#> pct_near_park_data = col_character(),
#> spend_per_resident_data = col_character(),
#> city_dup = col_character()
#> )
#> ℹ Use `spec()` for the full column specifications.
modeling_df <- parks %>%
select(pct_near_park_data, spend_per_resident_data, med_park_size_data) %>%
rename(nearness = "pct_near_park_data",
spending = "spend_per_resident_data",
acres = "med_park_size_data") %>%
mutate(nearness = (parse_number(nearness)/100)) %>%
mutate(spending = parse_number(spending))
set.seed(123)
park_split <- initial_split(modeling_df)
park_train <- training(park_split)
park_test <- testing(park_split)
tree_rec <- recipe(nearness ~., data = park_train)
tree_prep <- prep(tree_rec)
juiced <- juice(tree_prep)
tune_spec <- rand_forest(
mtry = tune(),
trees = 1000,
min_n = tune()
) %>%
set_mode("regression") %>%
set_engine("ranger")
tune_wf <- workflow() %>%
add_recipe(tree_rec) %>%
add_model(tune_spec)
set.seed(234)
park_folds <- vfold_cv(park_train, v = 5)
set.seed(345)
tune_res <- tune_grid(
tune_wf,
resamples = park_folds,
grid = 20,
control = control_grid(verbose = TRUE)
)
#> i Creating pre-processing data to finalize unknown parameter: mtry
#> i Fold1: preprocessor 1/1
#> ✓ Fold1: preprocessor 1/1
#> i Fold1: preprocessor 1/1, model 1/20
#> ✓ Fold1: preprocessor 1/1, model 1/20
#> i Fold1: preprocessor 1/1, model 1/20 (predictions)
#> i Fold1: preprocessor 1/1, model 2/20
#> ✓ Fold1: preprocessor 1/1, model 2/20
#> i Fold1: preprocessor 1/1, model 2/20 (predictions)
#> i Fold1: preprocessor 1/1, model 3/20
#> ✓ Fold1: preprocessor 1/1, model 3/20
#> i Fold1: preprocessor 1/1, model 3/20 (predictions)
#> i Fold1: preprocessor 1/1, model 4/20
#> ✓ Fold1: preprocessor 1/1, model 4/20
#> i Fold1: preprocessor 1/1, model 4/20 (predictions)
#> i Fold1: preprocessor 1/1, model 5/20
#> ✓ Fold1: preprocessor 1/1, model 5/20
#> i Fold1: preprocessor 1/1, model 5/20 (predictions)
#> i Fold1: preprocessor 1/1, model 6/20
#> ✓ Fold1: preprocessor 1/1, model 6/20
#> i Fold1: preprocessor 1/1, model 6/20 (predictions)
#> i Fold1: preprocessor 1/1, model 7/20
#> ✓ Fold1: preprocessor 1/1, model 7/20
#> i Fold1: preprocessor 1/1, model 7/20 (predictions)
#> i Fold1: preprocessor 1/1, model 8/20
#> ✓ Fold1: preprocessor 1/1, model 8/20
#> i Fold1: preprocessor 1/1, model 8/20 (predictions)
#> i Fold1: preprocessor 1/1, model 9/20
#> ✓ Fold1: preprocessor 1/1, model 9/20
#> i Fold1: preprocessor 1/1, model 9/20 (predictions)
#> i Fold1: preprocessor 1/1, model 10/20
#> ✓ Fold1: preprocessor 1/1, model 10/20
#> i Fold1: preprocessor 1/1, model 10/20 (predictions)
#> i Fold1: preprocessor 1/1, model 11/20
#> ✓ Fold1: preprocessor 1/1, model 11/20
#> i Fold1: preprocessor 1/1, model 11/20 (predictions)
#> i Fold1: preprocessor 1/1, model 12/20
#> ✓ Fold1: preprocessor 1/1, model 12/20
#> i Fold1: preprocessor 1/1, model 12/20 (predictions)
#> i Fold1: preprocessor 1/1, model 13/20
#> ✓ Fold1: preprocessor 1/1, model 13/20
#> i Fold1: preprocessor 1/1, model 13/20 (predictions)
#> i Fold1: preprocessor 1/1, model 14/20
#> ✓ Fold1: preprocessor 1/1, model 14/20
#> i Fold1: preprocessor 1/1, model 14/20 (predictions)
#> i Fold1: preprocessor 1/1, model 15/20
#> ✓ Fold1: preprocessor 1/1, model 15/20
#> i Fold1: preprocessor 1/1, model 15/20 (predictions)
#> i Fold1: preprocessor 1/1, model 16/20
#> ✓ Fold1: preprocessor 1/1, model 16/20
#> i Fold1: preprocessor 1/1, model 16/20 (predictions)
#> i Fold1: preprocessor 1/1, model 17/20
#> ✓ Fold1: preprocessor 1/1, model 17/20
#> i Fold1: preprocessor 1/1, model 17/20 (predictions)
#> i Fold1: preprocessor 1/1, model 18/20
#> ✓ Fold1: preprocessor 1/1, model 18/20
#> i Fold1: preprocessor 1/1, model 18/20 (predictions)
#> i Fold1: preprocessor 1/1, model 19/20
#> ✓ Fold1: preprocessor 1/1, model 19/20
#> i Fold1: preprocessor 1/1, model 19/20 (predictions)
#> i Fold1: preprocessor 1/1, model 20/20
#> ✓ Fold1: preprocessor 1/1, model 20/20
#> i Fold1: preprocessor 1/1, model 20/20 (predictions)
#> i Fold2: preprocessor 1/1
#> ✓ Fold2: preprocessor 1/1
#> i Fold2: preprocessor 1/1, model 1/20
#> ✓ Fold2: preprocessor 1/1, model 1/20
#> i Fold2: preprocessor 1/1, model 1/20 (predictions)
#> i Fold2: preprocessor 1/1, model 2/20
#> ✓ Fold2: preprocessor 1/1, model 2/20
#> i Fold2: preprocessor 1/1, model 2/20 (predictions)
#> i Fold2: preprocessor 1/1, model 3/20
#> ✓ Fold2: preprocessor 1/1, model 3/20
#> i Fold2: preprocessor 1/1, model 3/20 (predictions)
#> i Fold2: preprocessor 1/1, model 4/20
#> ✓ Fold2: preprocessor 1/1, model 4/20
#> i Fold2: preprocessor 1/1, model 4/20 (predictions)
#> i Fold2: preprocessor 1/1, model 5/20
#> ✓ Fold2: preprocessor 1/1, model 5/20
#> i Fold2: preprocessor 1/1, model 5/20 (predictions)
#> i Fold2: preprocessor 1/1, model 6/20
#> ✓ Fold2: preprocessor 1/1, model 6/20
#> i Fold2: preprocessor 1/1, model 6/20 (predictions)
#> i Fold2: preprocessor 1/1, model 7/20
#> ✓ Fold2: preprocessor 1/1, model 7/20
#> i Fold2: preprocessor 1/1, model 7/20 (predictions)
#> i Fold2: preprocessor 1/1, model 8/20
#> ✓ Fold2: preprocessor 1/1, model 8/20
#> i Fold2: preprocessor 1/1, model 8/20 (predictions)
#> i Fold2: preprocessor 1/1, model 9/20
#> ✓ Fold2: preprocessor 1/1, model 9/20
#> i Fold2: preprocessor 1/1, model 9/20 (predictions)
#> i Fold2: preprocessor 1/1, model 10/20
#> ✓ Fold2: preprocessor 1/1, model 10/20
#> i Fold2: preprocessor 1/1, model 10/20 (predictions)
#> i Fold2: preprocessor 1/1, model 11/20
#> ✓ Fold2: preprocessor 1/1, model 11/20
#> i Fold2: preprocessor 1/1, model 11/20 (predictions)
#> i Fold2: preprocessor 1/1, model 12/20
#> ✓ Fold2: preprocessor 1/1, model 12/20
#> i Fold2: preprocessor 1/1, model 12/20 (predictions)
#> i Fold2: preprocessor 1/1, model 13/20
#> ✓ Fold2: preprocessor 1/1, model 13/20
#> i Fold2: preprocessor 1/1, model 13/20 (predictions)
#> i Fold2: preprocessor 1/1, model 14/20
#> ✓ Fold2: preprocessor 1/1, model 14/20
#> i Fold2: preprocessor 1/1, model 14/20 (predictions)
#> i Fold2: preprocessor 1/1, model 15/20
#> ✓ Fold2: preprocessor 1/1, model 15/20
#> i Fold2: preprocessor 1/1, model 15/20 (predictions)
#> i Fold2: preprocessor 1/1, model 16/20
#> ✓ Fold2: preprocessor 1/1, model 16/20
#> i Fold2: preprocessor 1/1, model 16/20 (predictions)
#> i Fold2: preprocessor 1/1, model 17/20
#> ✓ Fold2: preprocessor 1/1, model 17/20
#> i Fold2: preprocessor 1/1, model 17/20 (predictions)
#> i Fold2: preprocessor 1/1, model 18/20
#> ✓ Fold2: preprocessor 1/1, model 18/20
#> i Fold2: preprocessor 1/1, model 18/20 (predictions)
#> i Fold2: preprocessor 1/1, model 19/20
#> ✓ Fold2: preprocessor 1/1, model 19/20
#> i Fold2: preprocessor 1/1, model 19/20 (predictions)
#> i Fold2: preprocessor 1/1, model 20/20
#> ✓ Fold2: preprocessor 1/1, model 20/20
#> i Fold2: preprocessor 1/1, model 20/20 (predictions)
#> i Fold3: preprocessor 1/1
#> ✓ Fold3: preprocessor 1/1
#> i Fold3: preprocessor 1/1, model 1/20
#> ✓ Fold3: preprocessor 1/1, model 1/20
#> i Fold3: preprocessor 1/1, model 1/20 (predictions)
#> i Fold3: preprocessor 1/1, model 2/20
#> ✓ Fold3: preprocessor 1/1, model 2/20
#> i Fold3: preprocessor 1/1, model 2/20 (predictions)
#> i Fold3: preprocessor 1/1, model 3/20
#> ✓ Fold3: preprocessor 1/1, model 3/20
#> i Fold3: preprocessor 1/1, model 3/20 (predictions)
#> i Fold3: preprocessor 1/1, model 4/20
#> ✓ Fold3: preprocessor 1/1, model 4/20
#> i Fold3: preprocessor 1/1, model 4/20 (predictions)
#> i Fold3: preprocessor 1/1, model 5/20
#> ✓ Fold3: preprocessor 1/1, model 5/20
#> i Fold3: preprocessor 1/1, model 5/20 (predictions)
#> i Fold3: preprocessor 1/1, model 6/20
#> ✓ Fold3: preprocessor 1/1, model 6/20
#> i Fold3: preprocessor 1/1, model 6/20 (predictions)
#> i Fold3: preprocessor 1/1, model 7/20
#> ✓ Fold3: preprocessor 1/1, model 7/20
#> i Fold3: preprocessor 1/1, model 7/20 (predictions)
#> i Fold3: preprocessor 1/1, model 8/20
#> ✓ Fold3: preprocessor 1/1, model 8/20
#> i Fold3: preprocessor 1/1, model 8/20 (predictions)
#> i Fold3: preprocessor 1/1, model 9/20
#> ✓ Fold3: preprocessor 1/1, model 9/20
#> i Fold3: preprocessor 1/1, model 9/20 (predictions)
#> i Fold3: preprocessor 1/1, model 10/20
#> ✓ Fold3: preprocessor 1/1, model 10/20
#> i Fold3: preprocessor 1/1, model 10/20 (predictions)
#> i Fold3: preprocessor 1/1, model 11/20
#> ✓ Fold3: preprocessor 1/1, model 11/20
#> i Fold3: preprocessor 1/1, model 11/20 (predictions)
#> i Fold3: preprocessor 1/1, model 12/20
#> ✓ Fold3: preprocessor 1/1, model 12/20
#> i Fold3: preprocessor 1/1, model 12/20 (predictions)
#> i Fold3: preprocessor 1/1, model 13/20
#> ✓ Fold3: preprocessor 1/1, model 13/20
#> i Fold3: preprocessor 1/1, model 13/20 (predictions)
#> i Fold3: preprocessor 1/1, model 14/20
#> ✓ Fold3: preprocessor 1/1, model 14/20
#> i Fold3: preprocessor 1/1, model 14/20 (predictions)
#> i Fold3: preprocessor 1/1, model 15/20
#> ✓ Fold3: preprocessor 1/1, model 15/20
#> i Fold3: preprocessor 1/1, model 15/20 (predictions)
#> i Fold3: preprocessor 1/1, model 16/20
#> ✓ Fold3: preprocessor 1/1, model 16/20
#> i Fold3: preprocessor 1/1, model 16/20 (predictions)
#> i Fold3: preprocessor 1/1, model 17/20
#> ✓ Fold3: preprocessor 1/1, model 17/20
#> i Fold3: preprocessor 1/1, model 17/20 (predictions)
#> i Fold3: preprocessor 1/1, model 18/20
#> ✓ Fold3: preprocessor 1/1, model 18/20
#> i Fold3: preprocessor 1/1, model 18/20 (predictions)
#> i Fold3: preprocessor 1/1, model 19/20
#> ✓ Fold3: preprocessor 1/1, model 19/20
#> i Fold3: preprocessor 1/1, model 19/20 (predictions)
#> i Fold3: preprocessor 1/1, model 20/20
#> ✓ Fold3: preprocessor 1/1, model 20/20
#> i Fold3: preprocessor 1/1, model 20/20 (predictions)
#> i Fold4: preprocessor 1/1
#> ✓ Fold4: preprocessor 1/1
#> i Fold4: preprocessor 1/1, model 1/20
#> ✓ Fold4: preprocessor 1/1, model 1/20
#> i Fold4: preprocessor 1/1, model 1/20 (predictions)
#> i Fold4: preprocessor 1/1, model 2/20
#> ✓ Fold4: preprocessor 1/1, model 2/20
#> i Fold4: preprocessor 1/1, model 2/20 (predictions)
#> i Fold4: preprocessor 1/1, model 3/20
#> ✓ Fold4: preprocessor 1/1, model 3/20
#> i Fold4: preprocessor 1/1, model 3/20 (predictions)
#> i Fold4: preprocessor 1/1, model 4/20
#> ✓ Fold4: preprocessor 1/1, model 4/20
#> i Fold4: preprocessor 1/1, model 4/20 (predictions)
#> i Fold4: preprocessor 1/1, model 5/20
#> ✓ Fold4: preprocessor 1/1, model 5/20
#> i Fold4: preprocessor 1/1, model 5/20 (predictions)
#> i Fold4: preprocessor 1/1, model 6/20
#> ✓ Fold4: preprocessor 1/1, model 6/20
#> i Fold4: preprocessor 1/1, model 6/20 (predictions)
#> i Fold4: preprocessor 1/1, model 7/20
#> ✓ Fold4: preprocessor 1/1, model 7/20
#> i Fold4: preprocessor 1/1, model 7/20 (predictions)
#> i Fold4: preprocessor 1/1, model 8/20
#> ✓ Fold4: preprocessor 1/1, model 8/20
#> i Fold4: preprocessor 1/1, model 8/20 (predictions)
#> i Fold4: preprocessor 1/1, model 9/20
#> ✓ Fold4: preprocessor 1/1, model 9/20
#> i Fold4: preprocessor 1/1, model 9/20 (predictions)
#> i Fold4: preprocessor 1/1, model 10/20
#> ✓ Fold4: preprocessor 1/1, model 10/20
#> i Fold4: preprocessor 1/1, model 10/20 (predictions)
#> i Fold4: preprocessor 1/1, model 11/20
#> ✓ Fold4: preprocessor 1/1, model 11/20
#> i Fold4: preprocessor 1/1, model 11/20 (predictions)
#> i Fold4: preprocessor 1/1, model 12/20
#> ✓ Fold4: preprocessor 1/1, model 12/20
#> i Fold4: preprocessor 1/1, model 12/20 (predictions)
#> i Fold4: preprocessor 1/1, model 13/20
#> ✓ Fold4: preprocessor 1/1, model 13/20
#> i Fold4: preprocessor 1/1, model 13/20 (predictions)
#> i Fold4: preprocessor 1/1, model 14/20
#> ✓ Fold4: preprocessor 1/1, model 14/20
#> i Fold4: preprocessor 1/1, model 14/20 (predictions)
#> i Fold4: preprocessor 1/1, model 15/20
#> ✓ Fold4: preprocessor 1/1, model 15/20
#> i Fold4: preprocessor 1/1, model 15/20 (predictions)
#> i Fold4: preprocessor 1/1, model 16/20
#> ✓ Fold4: preprocessor 1/1, model 16/20
#> i Fold4: preprocessor 1/1, model 16/20 (predictions)
#> i Fold4: preprocessor 1/1, model 17/20
#> ✓ Fold4: preprocessor 1/1, model 17/20
#> i Fold4: preprocessor 1/1, model 17/20 (predictions)
#> i Fold4: preprocessor 1/1, model 18/20
#> ✓ Fold4: preprocessor 1/1, model 18/20
#> i Fold4: preprocessor 1/1, model 18/20 (predictions)
#> i Fold4: preprocessor 1/1, model 19/20
#> ✓ Fold4: preprocessor 1/1, model 19/20
#> i Fold4: preprocessor 1/1, model 19/20 (predictions)
#> i Fold4: preprocessor 1/1, model 20/20
#> ✓ Fold4: preprocessor 1/1, model 20/20
#> i Fold4: preprocessor 1/1, model 20/20 (predictions)
#> i Fold5: preprocessor 1/1
#> ✓ Fold5: preprocessor 1/1
#> i Fold5: preprocessor 1/1, model 1/20
#> ✓ Fold5: preprocessor 1/1, model 1/20
#> i Fold5: preprocessor 1/1, model 1/20 (predictions)
#> i Fold5: preprocessor 1/1, model 2/20
#> ✓ Fold5: preprocessor 1/1, model 2/20
#> i Fold5: preprocessor 1/1, model 2/20 (predictions)
#> i Fold5: preprocessor 1/1, model 3/20
#> ✓ Fold5: preprocessor 1/1, model 3/20
#> i Fold5: preprocessor 1/1, model 3/20 (predictions)
#> i Fold5: preprocessor 1/1, model 4/20
#> ✓ Fold5: preprocessor 1/1, model 4/20
#> i Fold5: preprocessor 1/1, model 4/20 (predictions)
#> i Fold5: preprocessor 1/1, model 5/20
#> ✓ Fold5: preprocessor 1/1, model 5/20
#> i Fold5: preprocessor 1/1, model 5/20 (predictions)
#> i Fold5: preprocessor 1/1, model 6/20
#> ✓ Fold5: preprocessor 1/1, model 6/20
#> i Fold5: preprocessor 1/1, model 6/20 (predictions)
#> i Fold5: preprocessor 1/1, model 7/20
#> ✓ Fold5: preprocessor 1/1, model 7/20
#> i Fold5: preprocessor 1/1, model 7/20 (predictions)
#> i Fold5: preprocessor 1/1, model 8/20
#> ✓ Fold5: preprocessor 1/1, model 8/20
#> i Fold5: preprocessor 1/1, model 8/20 (predictions)
#> i Fold5: preprocessor 1/1, model 9/20
#> ✓ Fold5: preprocessor 1/1, model 9/20
#> i Fold5: preprocessor 1/1, model 9/20 (predictions)
#> i Fold5: preprocessor 1/1, model 10/20
#> ✓ Fold5: preprocessor 1/1, model 10/20
#> i Fold5: preprocessor 1/1, model 10/20 (predictions)
#> i Fold5: preprocessor 1/1, model 11/20
#> ✓ Fold5: preprocessor 1/1, model 11/20
#> i Fold5: preprocessor 1/1, model 11/20 (predictions)
#> i Fold5: preprocessor 1/1, model 12/20
#> ✓ Fold5: preprocessor 1/1, model 12/20
#> i Fold5: preprocessor 1/1, model 12/20 (predictions)
#> i Fold5: preprocessor 1/1, model 13/20
#> ✓ Fold5: preprocessor 1/1, model 13/20
#> i Fold5: preprocessor 1/1, model 13/20 (predictions)
#> i Fold5: preprocessor 1/1, model 14/20
#> ✓ Fold5: preprocessor 1/1, model 14/20
#> i Fold5: preprocessor 1/1, model 14/20 (predictions)
#> i Fold5: preprocessor 1/1, model 15/20
#> ✓ Fold5: preprocessor 1/1, model 15/20
#> i Fold5: preprocessor 1/1, model 15/20 (predictions)
#> i Fold5: preprocessor 1/1, model 16/20
#> ✓ Fold5: preprocessor 1/1, model 16/20
#> i Fold5: preprocessor 1/1, model 16/20 (predictions)
#> i Fold5: preprocessor 1/1, model 17/20
#> ✓ Fold5: preprocessor 1/1, model 17/20
#> i Fold5: preprocessor 1/1, model 17/20 (predictions)
#> i Fold5: preprocessor 1/1, model 18/20
#> ✓ Fold5: preprocessor 1/1, model 18/20
#> i Fold5: preprocessor 1/1, model 18/20 (predictions)
#> i Fold5: preprocessor 1/1, model 19/20
#> ✓ Fold5: preprocessor 1/1, model 19/20
#> i Fold5: preprocessor 1/1, model 19/20 (predictions)
#> i Fold5: preprocessor 1/1, model 20/20
#> ✓ Fold5: preprocessor 1/1, model 20/20
#> i Fold5: preprocessor 1/1, model 20/20 (predictions)
由 reprex package (v2.0.0)
于 2021-06-27 创建我确实看到了详细的输出。
我怀疑您可能在某个时候打开了并行处理,这会关闭 return 详细日志记录的能力。目前无法使用我们支持的并行后端从工作人员收集日志记录。