diff --git a/NEWS.md b/NEWS.md index e35213c7..3961e451 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,7 @@ * Fixed an error in `int_conformal_cv()` when grouped resampling was used (#141). +* Fixed an issue where the `distance` metric appeared inconsistently when using `threshold_perf()` with custom metric sets (#149). # probably 1.0.3 diff --git a/R/threshold_perf.R b/R/threshold_perf.R index 238c4d7e..9f9bf634 100644 --- a/R/threshold_perf.R +++ b/R/threshold_perf.R @@ -199,11 +199,11 @@ threshold_perf.data.frame <- function(.data, # Create the `distance` metric data frame # and add it on 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 specificity currently. This recodes as distance @@ -232,7 +232,9 @@ expand_preds <- function(.data, threshold, inc = NULL) { check_thresholded_metrics <- function(x) { y <- dplyr::as_tibble(x) if (!all(y$class == "class_metric")) { - rlang::abort("All metrics must be of type 'class_metric' (e.g. `sensitivity()`, ect)") + rlang::abort( + "All metrics must be of type 'class_metric' (e.g. `sensitivity()`, ect)" + ) } # check to see if sensitivity and specificity are in the lists has_sens <-