Skip to content

Commit

Permalink
updated for changes in #804
Browse files Browse the repository at this point in the history
  • Loading branch information
‘topepo’ committed Jan 11, 2024
1 parent 2153a7c commit e3d9857
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 89 deletions.
4 changes: 0 additions & 4 deletions tests/testthat/_snaps/survival-tune-bayes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Bayesian tuning survival models with integrated metric

Evaluation times are only required when dynmanic or integrated metrics are selected as the primary metric (and will be ignored).

# Bayesian tuning survival models with dynamic metric

4 evaluation times were specified during tuning; the first (10) will be used.
Expand Down
4 changes: 0 additions & 4 deletions tests/testthat/_snaps/survival-tune-sa.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# sim annealing tuning survival models with integrated metric

Evaluation times are only required when dynmanic or integrated metrics are selected as the primary metric (and will be ignored).

# sim annealing tuning survival models with dynamic metric

4 evaluation times were specified during tuning; the first (10) will be used.
Expand Down
8 changes: 0 additions & 8 deletions tests/testthat/_snaps/survival-tune_race_anova.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@

Evaluation times are only required when dynmanic or integrated metrics are selected as the primary metric (and will be ignored).

---

Evaluation times are only required when dynmanic or integrated metrics are selected as the primary metric (and will be ignored).

# race tuning (anova) survival models with dynamic metrics

4 evaluation times were specified during tuning; the first (10) will be used.

---

No evaluation time was set; a value of 5 was used.

# race tuning (anova) survival models with mixture of metric types

4 evaluation times were specified during tuning; the first (10) will be used.
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 0 additions & 4 deletions tests/testthat/_snaps/survival-tune_race_win_loss.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Evaluation times are only required when dynmanic or integrated metrics are selected as the primary metric (and will be ignored).

---

Evaluation times are only required when dynmanic or integrated metrics are selected as the primary metric (and will be ignored).

# race tuning (win_loss) survival models with dynamic metrics

4 evaluation times were specified during tuning; the first (10) will be used.
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-survival-fit-resamples.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ suppressPackageStartupMessages(library(baguette))

skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.2.9009")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("yardstick", minimum_version = "1.2.0.9001")

test_that("resampling survival models with static metric", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-survival-last-fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ suppressPackageStartupMessages(library(censored))

skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.2.9009")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("yardstick", minimum_version = "1.2.0.9001")

test_that("last fit for survival models with static metric", {
Expand Down
4 changes: 1 addition & 3 deletions tests/testthat/test-survival-tune-bayes.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ suppressPackageStartupMessages(library(censored))

skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.2.9009")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("yardstick", minimum_version = "1.2.0.9001")

test_that("Bayesian tuning survival models with static metric", {
Expand Down Expand Up @@ -185,7 +185,6 @@ test_that("Bayesian tuning survival models with integrated metric", {
control = gctrl
)

expect_snapshot_warning({
set.seed(2193)
bayes_integrated_res <-
mod_spec %>%
Expand All @@ -198,7 +197,6 @@ test_that("Bayesian tuning survival models with integrated metric", {
control = bctrl,
initial = init_grid_integrated_res
)
})

# test structure of results --------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-survival-tune-eval-time-attribute.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ suppressPackageStartupMessages(library(finetune))

skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.1.9002")
skip_if_not_installed("finetune", minimum_version = "1.1.0.9003")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("finetune", minimum_version = "1.1.0.9005")


test_that("fit_resamples save eval_time", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-survival-tune-grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ suppressPackageStartupMessages(library(censored))

skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.2.9009")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("yardstick", minimum_version = "1.2.0.9001")

test_that("grid tuning survival models with static metric", {
Expand Down
34 changes: 15 additions & 19 deletions tests/testthat/test-survival-tune-sa.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ suppressPackageStartupMessages(library(tidymodels))
suppressPackageStartupMessages(library(censored))
suppressPackageStartupMessages(library(finetune))

skip_if_not_installed("finetune", minimum_version = "1.1.0.9001")
skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.2.9009")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("yardstick", minimum_version = "1.2.0.9001")
skip_if_not_installed("finetune", minimum_version = "1.1.0.9001")
skip_if_not_installed("finetune", minimum_version = "1.1.0.9005")

test_that("sim annealing tuning survival models with static metric", {
skip_if_not_installed("mboost")
Expand Down Expand Up @@ -200,22 +199,19 @@ test_that("sim annealing tuning survival models with integrated metric", {
control = gctrl
)

expect_snapshot_warning({
set.seed(2193)
sa_integrated_res <-
mod_spec %>%
tune_sim_anneal(
event_time ~ X1 + X2,
resamples = sim_rs,
iter = 2,
param_info = mod_param,
metrics = sint_mtrc,
eval_time = time_points,
control = sctrl,
initial = init_grid_integrated_res
)
})

set.seed(2193)
sa_integrated_res <-
mod_spec %>%
tune_sim_anneal(
event_time ~ X1 + X2,
resamples = sim_rs,
iter = 2,
param_info = mod_param,
metrics = sint_mtrc,
eval_time = time_points,
control = sctrl,
initial = init_grid_integrated_res
)

# test structure of results --------------------------------------------------

Expand Down
39 changes: 12 additions & 27 deletions tests/testthat/test-survival-tune_race_anova.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ suppressPackageStartupMessages(library(tidymodels))
suppressPackageStartupMessages(library(censored))
suppressPackageStartupMessages(library(finetune))

skip_if_not_installed("finetune", minimum_version = "1.1.0.9001")
skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.2.9009")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("yardstick", minimum_version = "1.2.0.9001")
skip_if_not_installed("finetune", minimum_version = "1.1.0.9005")

Expand Down Expand Up @@ -179,19 +178,17 @@ test_that("race tuning (anova) survival models with integrated metric", {

sint_mtrc <- metric_set(brier_survival_integrated)

expect_snapshot_warning({
set.seed(2193)
aov_integrated_res <-
mod_spec %>%
tune_race_anova(
event_time ~ X1 + X2,
resamples = sim_rs,
grid = grid,
metrics = sint_mtrc,
eval_time = time_points,
control = rctrl
)
})
set.seed(2193)
aov_integrated_res <-
mod_spec %>%
tune_race_anova(
event_time ~ X1 + X2,
resamples = sim_rs,
grid = grid,
metrics = sint_mtrc,
eval_time = time_points,
control = rctrl
)

expect_snapshot_warning({
num_final_aov <-
Expand Down Expand Up @@ -404,18 +401,6 @@ test_that("race tuning (anova) survival models with dynamic metrics", {
"dyn-aov-race-plot"
)

expect_snapshot_plot(
print(autoplot(aov_dyn_res, eval_time = c(1, 5))),
"dyn-aov-race-2-times"
)

expect_snapshot_warning(
expect_snapshot_plot(
print(autoplot(aov_dyn_res)),
"dyn-aov-race-0-times"
)
)

# test metric collection -----------------------------------------------------

exp_metric_sum <- tibble(
Expand Down
27 changes: 12 additions & 15 deletions tests/testthat/test-survival-tune_race_win_loss.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ suppressPackageStartupMessages(library(tidymodels))
suppressPackageStartupMessages(library(censored))
suppressPackageStartupMessages(library(finetune))

skip_if_not_installed("finetune", minimum_version = "1.1.0.9001")
skip_if_not_installed("parsnip", minimum_version = "1.1.0.9003")
skip_if_not_installed("censored", minimum_version = "0.2.0.9000")
skip_if_not_installed("tune", minimum_version = "1.1.2.9009")
skip_if_not_installed("tune", minimum_version = "1.1.2.9010")
skip_if_not_installed("yardstick", minimum_version = "1.2.0.9001")
skip_if_not_installed("finetune", minimum_version = "1.1.0.9005")

Expand Down Expand Up @@ -177,19 +176,17 @@ test_that("race tuning (win_loss) survival models with integrated metric", {

sint_mtrc <- metric_set(brier_survival_integrated)

expect_snapshot_warning({
set.seed(2193)
wl_integrated_res <-
mod_spec %>%
tune_race_win_loss(
event_time ~ X1 + X2,
resamples = sim_rs,
grid = grid,
metrics = sint_mtrc,
eval_time = time_points,
control = rctrl
)
})
set.seed(2193)
wl_integrated_res <-
mod_spec %>%
tune_race_win_loss(
event_time ~ X1 + X2,
resamples = sim_rs,
grid = grid,
metrics = sint_mtrc,
eval_time = time_points,
control = rctrl
)

expect_snapshot_warning({
num_final_wl <-
Expand Down

0 comments on commit e3d9857

Please sign in to comment.