Skip to content

Commit

Permalink
set seed to get reproducible test
Browse files Browse the repository at this point in the history
  • Loading branch information
‘topepo’ committed Feb 22, 2024
1 parent 0016ca4 commit 30dd9c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/cal-estimate.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
Type: Binary
Source class: Data Frame
Data points: 1,010, split in 2 groups
Unique Predicted Values: 19
Unique Predicted Values: 59
Truth variable: `Class`
Estimate variables:
`.pred_good` ==> good
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-cal-estimate.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ test_that("Isotonic estimates work - data.frame", {
expect_cal_rows(sl_isotonic)
expect_snapshot(print(sl_isotonic))

set.seed(100)
sl_isotonic_group <- segment_logistic %>%
dplyr::mutate(group = .pred_poor > 0.5) %>%
cal_estimate_isotonic(Class, .by = group)
Expand All @@ -121,17 +122,20 @@ test_that("Isotonic estimates work - data.frame", {
expect_cal_rows(sl_isotonic_group)
expect_snapshot(print(sl_isotonic_group))

set.seed(100)
expect_snapshot_error(
segment_logistic %>%
dplyr::mutate(group1 = 1, group2 = 2) %>%
cal_estimate_isotonic(Class, .by = c(group1, group2))
)

set.seed(100)
iso_configs <-
bin_with_configs() %>%
cal_estimate_isotonic(truth = Class)
expect_true(are_groups_configs(iso_configs))

set.seed(100)
mltm_configs <-
mnl_with_configs() %>%
cal_estimate_isotonic(truth = obs, estimate = c(VF:L))
Expand Down

0 comments on commit 30dd9c2

Please sign in to comment.