Skip to content

Commit

Permalink
Updated tests for threshold_perf() to use the updated metric names
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwinget committed Aug 15, 2024
1 parent 4cd3800 commit bd340f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions tests/testthat/_snaps/threshold-perf.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
dplyr::count(.metric)
Output
# A tibble: 5 x 2
.metric n
<chr> <int>
1 accuracy 21
2 distance 21
3 mcc 21
4 sens 21
5 spec 21
.metric n
<chr> <int>
1 accuracy 21
2 distance 21
3 mcc 21
4 sensitivity 21
5 specificity 21

---

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-threshold-perf.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ get_res <- function(prob, obs, cut) {

# Create the `distance` metric data frame
sens_vec <- .data_metrics %>%
dplyr::filter(.metric == "sens") %>%
dplyr::filter(.metric == "sensitivity") %>%
dplyr::pull(.estimate)

dist <- .data_metrics %>%
dplyr::filter(.metric == "spec") %>%
dplyr::filter(.metric == "specificity") %>%
dplyr::mutate(
.metric = "distance",
# .estimate is spec currently
Expand Down Expand Up @@ -123,8 +123,8 @@ test_that("custom metrics", {
suppressPackageStartupMessages(require(yardstick))
suppressPackageStartupMessages(require(dplyr))

cls_met_bad <- metric_set(sens, spec, accuracy, roc_auc)
cls_met_good <- metric_set(sens, spec, accuracy, mcc)
cls_met_bad <- metric_set(sensitivity, specificity, accuracy, roc_auc)
cls_met_good <- metric_set(sensitivity, specificity, accuracy, mcc)
cls_met_other <- metric_set(accuracy, mcc)

expect_snapshot_error(
Expand Down

0 comments on commit bd340f1

Please sign in to comment.