diff --git a/tests/testthat/helper-postprocessing.R b/tests/testthat/helper-postprocessing.R index 60e76a10e..471a3d0e5 100644 --- a/tests/testthat/helper-postprocessing.R +++ b/tests/testthat/helper-postprocessing.R @@ -130,6 +130,9 @@ if (rlang::is_installed("probably")) { reg_cal <- tailor::tailor() |> tailor::adjust_numeric_calibration() + reg_cal_tune <- tailor::tailor() |> + tailor::adjust_numeric_calibration(method = tune()) + reg_max <- tailor::tailor() |> tailor::adjust_numeric_range(upper_limit = tune()) } diff --git a/tests/testthat/test-loop-over-all-stages-row-wise.R b/tests/testthat/test-loop-over-all-stages-row-wise.R index 99c0df16e..7f66239f1 100644 --- a/tests/testthat/test-loop-over-all-stages-row-wise.R +++ b/tests/testthat/test-loop-over-all-stages-row-wise.R @@ -85,7 +85,7 @@ test_that("convert grid to rowwise - submodels", { skip_if_not_installed("probably") # Model only - wflow_1 <- workflow(Class ~ ., glmn_spec, cls_est_post) + wflow_1 <- workflow(Class ~ ., glmn_spec, reg_cal) param_1 <- wflow_1 |> extract_parameter_set_dials() grid_reg_1 <- grid_regular(param_1) |> arrange(mixture, penalty) @@ -107,7 +107,7 @@ test_that("convert grid to rowwise - submodels", { } # Recipe + Model - wflow_2 <- workflow(puromycin_tune_rec, glmn_spec, cls_est_post) + wflow_2 <- workflow(puromycin_tune_rec, glmn_spec, reg_cal) param_2 <- wflow_2 |> extract_parameter_set_dials() grid_reg_2 <- grid_regular(param_2) @@ -133,54 +133,54 @@ test_that("convert grid to rowwise - submodels", { } # Model + Post - wflow_3 <- workflow(Class ~ ., glmn_spec, cls_post) + wflow_3 <- workflow(Class ~ ., glmn_spec, reg_cal_tune) param_3 <- wflow_3 |> extract_parameter_set_dials() grid_reg_3 <- grid_regular(param_3) - distinct_reg_3 <- distinct(grid_reg_3, cut, mixture) |> - arrange(mixture, cut) + distinct_reg_3 <- distinct(grid_reg_3, method, mixture) |> + arrange(mixture, method) res_reg_3 <- tune:::get_row_wise_grid(wflow_3, grid_reg_3) for (i in 1:nrow(distinct_reg_3)) { sub <- grid_reg_3 |> - inner_join(distinct_reg_3[i, ], by = c("mixture", "cut")) + inner_join(distinct_reg_3[i, ], by = c("mixture", "method")) expect_equal(res_reg_3[[i]], sub) } grid_sfd_3 <- grid_space_filling(param_3) - distinct_sfd_3 <- distinct(grid_sfd_3, cut, mixture) |> - arrange(mixture, cut) + distinct_sfd_3 <- distinct(grid_sfd_3, method, mixture) |> + arrange(mixture, method) res_sfd_3 <- tune:::get_row_wise_grid(wflow_3, grid_sfd_3) for (i in 1:nrow(distinct_sfd_3)) { sub <- grid_sfd_3 |> - inner_join(distinct_sfd_3[i, ], by = c("mixture", "cut")) + inner_join(distinct_sfd_3[i, ], by = c("mixture", "method")) expect_equal(res_sfd_3[[i]], sub) } # Recipe + Model + Post - wflow_4 <- workflow(puromycin_tune_rec, glmn_spec, cls_post) + wflow_4 <- workflow(puromycin_tune_rec, glmn_spec, reg_cal_tune) param_4 <- wflow_4 |> extract_parameter_set_dials() grid_reg_4 <- grid_regular(param_4) - distinct_reg_4 <- distinct(grid_reg_4, degree, cut, mixture) |> - arrange(mixture, degree, cut) + distinct_reg_4 <- distinct(grid_reg_4, degree, method, mixture) |> + arrange(mixture, degree, method) res_reg_4 <- tune:::get_row_wise_grid(wflow_4, grid_reg_4) for (i in 1:nrow(distinct_reg_4)) { sub <- grid_reg_4 |> - inner_join(distinct_reg_4[i, ], by = c("mixture", "degree", "cut")) + inner_join(distinct_reg_4[i, ], by = c("mixture", "degree", "method")) expect_equal(res_reg_4[[i]], sub) } grid_sfd_4 <- grid_space_filling(param_4) - distinct_sfd_4 <- distinct(grid_sfd_4, degree, cut, mixture) |> - arrange(mixture, degree, cut) + distinct_sfd_4 <- distinct(grid_sfd_4, degree, method, mixture) |> + arrange(mixture, degree, method) res_sfd_4 <- tune:::get_row_wise_grid(wflow_4, grid_sfd_4) for (i in 1:nrow(distinct_sfd_4)) { sub <- grid_sfd_4 |> - inner_join(distinct_sfd_4[i, ], by = c("mixture", "degree", "cut")) + inner_join(distinct_sfd_4[i, ], by = c("mixture", "degree", "method")) expect_equal(res_sfd_4[[i]], sub) } }) diff --git a/tests/testthat/test-schedule.R b/tests/testthat/test-schedule.R index d1d301b49..694ef9faa 100644 --- a/tests/testthat/test-schedule.R +++ b/tests/testthat/test-schedule.R @@ -468,7 +468,7 @@ test_that("grid processing schedule - recipe, model, and post", { skip_if_not_installed("splines2") skip_if_not_installed("probably") - wflow_three <- workflow(rec_no_tune, parsnip::logistic_reg(), tlr_no_tune) + wflow_three <- workflow(rec_no_tune, parsnip::linear_reg(), tlr_no_tune) grid_three <- tibble::tibble() sched_three <- schedule_grid(grid_three, wflow_three) @@ -733,7 +733,7 @@ test_that("grid processing schedule - model only, submodels, 1 point design", { test_that("grid processing schedule - postprocessing only", { skip_if_not_installed("probably") - wflow_thrsh <- workflow(outcome ~ ., parsnip::logistic_reg(), tlr_tune) + wflow_thrsh <- workflow(outcome ~ ., parsnip::linear_reg(), tlr_tune) grid_thrsh <- extract_parameter_set_dials(wflow_thrsh) |> update(lower_limit = dials::lower_limit(c(0, 1))) |> dials::grid_regular(levels = 3) @@ -767,7 +767,7 @@ test_that("grid processing schedule - recipe + postprocessing, regular grid", { skip_if_not_installed("splines2") skip_if_not_installed("probably") - wflow_pre_post <- workflow(rec_tune, parsnip::logistic_reg(), tlr_tune) + wflow_pre_post <- workflow(rec_tune, parsnip::linear_reg(), tlr_tune) grid_pre_post <- extract_parameter_set_dials(wflow_pre_post) |> update(lower_limit = dials::lower_limit(c(0, 1))) |> @@ -816,7 +816,7 @@ test_that("grid processing schedule - recipe + postprocessing, irregular grid", skip_if_not_installed("splines2") skip_if_not_installed("probably") - wflow_pre_post <- workflow(rec_tune, parsnip::logistic_reg(), tlr_tune) + wflow_pre_post <- workflow(rec_tune, parsnip::linear_reg(), tlr_tune) grid_pre_post <- extract_parameter_set_dials(wflow_pre_post) |> update(lower_limit = dials::lower_limit(c(0, 1))) |>