Skip to content

Commit

Permalink
changes for dev tune and column reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
‘topepo’ committed Feb 21, 2024
1 parent 1d4b4c1 commit 96ff4dd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ Imports:
rlang (>= 1.0.4),
tidyr (>= 1.3.0),
tidyselect (>= 1.1.2),
tune (>= 1.1.0),
tune (>= 1.1.2.9020),
vctrs (>= 0.4.1),
withr,
workflows,
yardstick (> 1.0.0)
workflows (>= 1.1.4),
yardstick (>= 1.3.0)
Suggests:
betacal,
covr,
Expand All @@ -44,13 +44,15 @@ Suggests:
mgcv,
modeldata (>= 1.1.0),
nnet,
parsnip,
parsnip (>= 1.2.0),
quantregForest,
randomForest,
recipes,
rmarkdown,
rsample,
testthat (>= 3.0.0)
Remotes:
tidymodels/tune
VignetteBuilder:
knitr
ByteCompile: true
Expand Down
Binary file modified tests/testthat/_snaps/cal-plot/cal_plot_breaks-df-group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/cal-plot/cal_plot_logistic-df-group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/cal-plot/df-scat-group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test-cal-validate-multiclass.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test_that("Isotonic validation with `fit_resamples` - Multiclass", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred_one", ".pred_two", ".pred_three", ".pred_class")
c(".pred_one", ".pred_two", ".pred_three", ".row", "outcome", ".config", ".pred_class")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down
22 changes: 11 additions & 11 deletions tests/testthat/test-cal-validate.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test_that("Logistic validation with data frame input", {
expect_equal(
names(pred_rs),
c(
"Class", ".row", ".config", ".pred_poor", ".pred_good", ".pred_class",
".pred_class", ".pred_poor", ".pred_good", "Class", ".row", ".config",
".type"
)
)
Expand Down Expand Up @@ -272,7 +272,7 @@ test_that("Logistic validation with `fit_resamples`", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred_class_1", ".pred_class_2", ".pred_class")
c(".pred_class_1", ".pred_class_2", ".row", "outcome", ".config", ".pred_class")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down Expand Up @@ -302,7 +302,7 @@ test_that("Isotonic classification validation with `fit_resamples`", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred_class_1", ".pred_class_2", ".pred_class")
c(".pred_class_1", ".pred_class_2", ".row", "outcome", ".config", ".pred_class")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down Expand Up @@ -333,7 +333,7 @@ test_that("Bootstrapped isotonic classification validation with `fit_resamples`"
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred_class_1", ".pred_class_2", ".pred_class")
c(".pred_class_1", ".pred_class_2", ".row", "outcome", ".config", ".pred_class")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down Expand Up @@ -363,7 +363,7 @@ test_that("Beta calibration validation with `fit_resamples`", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred_class_1", ".pred_class_2", ".pred_class")
c(".pred_class_1", ".pred_class_2", ".row", "outcome", ".config", ".pred_class")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down Expand Up @@ -393,7 +393,7 @@ test_that("Multinomial calibration validation with `fit_resamples`", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred_one", ".pred_two", ".pred_three", ".pred_class")
c(".pred_one", ".pred_two", ".pred_three", ".row", "outcome", ".config", ".pred_class")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down Expand Up @@ -427,7 +427,7 @@ test_that("Linear validation with `fit_resamples`", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred")
c(".pred", ".row", "outcome", ".config")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down Expand Up @@ -457,15 +457,15 @@ test_that("Linear validation with `fit_resamples`", {
expect_equal(sort(unique(pred$.type)), c("uncalibrated"))
expect_equal(
names(pred),
c(".row", "outcome", ".config", ".pred", ".type")
c(".pred", ".row", "outcome", ".config", ".type")
)
expect_equal(nrow(pred), nrow(val_obj$splits[[1]]$data))

pred_rs <- collect_predictions(val_with_pred)
expect_equal(sort(unique(pred_rs$.type)), c("calibrated", "uncalibrated"))
expect_equal(
names(pred_rs),
c(".row", "outcome", ".config", ".pred", ".type")
c(".pred", ".row", "outcome", ".config", ".type")
)
expect_equal(nrow(pred_rs), nrow(val_obj$splits[[1]]$data) * 2)
})
Expand Down Expand Up @@ -494,7 +494,7 @@ test_that("Isotonic regression validation with `fit_resamples`", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred")
c(".pred", ".row", "outcome", ".config")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down Expand Up @@ -528,7 +528,7 @@ test_that("Isotonic bootstrapped regression validation with `fit_resamples`", {
)
expect_equal(
names(val_with_pred$.predictions_cal[[1]]),
c(".row", "outcome", ".config", ".pred")
c(".pred", ".row", "outcome", ".config")
)
expect_equal(
purrr::map_int(val_with_pred$splits, ~ holdout_length(.x)),
Expand Down

0 comments on commit 96ff4dd

Please sign in to comment.