Skip to content

Commit fa91f90

Browse files
Release Candidate 1.4.0 (#632)
1 parent 60301eb commit fa91f90

File tree

99 files changed

+321
-900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+321
-900
lines changed

.claude/skills/tidy-deprecate-function/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Guide for deprecating R functions/arguments. Use when a user asks t
66
# Deprecate functions and function arguments
77

88
Use this skill when deprecating functions or function parameters in dbplyr.
9-
9+
<!-- -->
1010
## Overview
1111

1212
This skill guides you through the complete process of deprecating a function or parameter, ensuring all necessary changes are made consistently:

DESCRIPTION

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: yardstick
33
Title: Tidy Characterizations of Model Performance
4-
Version: 1.3.2.9000
4+
Version: 1.4.0.9000
55
Authors@R: c(
66
person("Max", "Kuhn", , "max@posit.co", role = "aut"),
77
person("Davis", "Vaughan", , "davis@posit.co", role = "aut"),
@@ -23,7 +23,7 @@ Imports:
2323
cli,
2424
dplyr (>= 1.1.0),
2525
generics (>= 0.1.2),
26-
hardhat (>= 1.4.2.9000),
26+
hardhat (>= 1.4.3),
2727
lifecycle (>= 1.0.3),
2828
rlang (>= 1.1.4),
2929
tibble,
@@ -137,5 +137,3 @@ Collate:
137137
'template.R'
138138
'validation.R'
139139
'yardstick-package.R'
140-
Remotes:
141-
tidymodels/hardhat

NEWS.md

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,86 @@
11
# yardstick (development version)
22

3-
* `sedi()` was added to compute the Symmetric Extremal Dependence Index, a prevalence-independent skill metric for classification. SEDI remains reliable at extreme class imbalance (prevalence < 2.5%) where TSS and MCC degrade. Supports binary and multiclass (macro, macro-weighted, micro averaging via one-vs-all decomposition). Based on Ferro & Stephenson (2011) and recommended by Wunderlich et al. (2019) for species distribution models with rare events.
3+
# yardstick 1.4.0
44

5-
* `brier_class()` has gained the `event_level` argument. (#515)
5+
## Breaking Changes
66

7-
* `gini_coef()` was added to compute the normalized Gini coefficient for regression, which measures ranking ability based on the Lorenz curve. This is useful for evaluating loss cost models and risk predictions. (#147)
7+
* The global option `yardstick.event_first` (deprecated in 0.0.7) now throws an error. Use the `event_level` argument of individual metric functions instead. (#632)
88

9-
* `roc_dist()` was added to compute the Euclidean distance from (sensitivity, specificity) to the ideal point (1, 1) in ROC space. (#148)
9+
* `conf_mat()` now throws an error if anything is passed to `...` (deprecated in 1.0.0). This argument has had no effect since case weight support was added. (#632)
1010

11-
* `rmse_relative()` was added to compute relative root mean squared error, which normalizes RMSE by the range of the true values. (#527)
11+
* `roc_auc()`, `roc_aunp()`, `roc_aunu()`, and `roc_curve()` now throw an error if a non-empty list is passed to `options` (deprecated in 1.0.0). Use the pROC package directly if you need these features. (#632)
1212

13-
* `mse()` was added to compute the mean squared error. (#560)
13+
## Deprecations
1414

15-
* Added documentation pages for each metric type (e.g., `?class-metrics`, `?numeric-metrics`) that list all available metrics with their direction and range. (#547, #540)
15+
* `dots_to_estimate()`, `metric_summarizer()`, and `metric_vec_template()` (soft-deprecated in 1.2.0) now warn for all users. See the yardstick 1.2.0 release notes for recommended replacements. (#632)
1616

17-
* For metrics with alternate argument values that will be used in a metric set, the documentation pages emphasize doing this via `metric_tweak()` #626
17+
## New Metrics
1818

19-
* `get_metrics()` was added to return a `metric_set()` containing all metrics of a specified type. (#534)
19+
* `gini_coef()` computes the normalized Gini coefficient for regression, which measures ranking ability based on the Lorenz curve. (#147)
2020

21-
* All class metrics and probability metrics now include mathematical formulas in their documentation. (#605)
21+
* `mse()` computes the mean squared error. (#560)
2222

23-
* `mpe()` documentation now includes the formula and clarifies the interpretation of positive and negative values. (#345)
23+
* `rmse_relative()` computes the relative root mean squared error, normalizing RMSE by the range of the true values. (#527)
2424

25-
* `classification_cost()` documentation now correctly refers to the `cost` column of the data.frame that can be passed to the `costs` arguemtn. (#343)
25+
* `fall_out()` and `miss_rate()` compute the false positive rate and false negative rate respectively. (#336)
2626

27-
* `new_metric()` and related functions gain an optional `range` argument to store the valid output range of a metric. This is a developer-facing change. (#572)
27+
* `markedness()` computes the markedness metric (PPV + NPV - 1), the predictive power analog of `j_index()`. (#27)
2828

29-
* `markedness()` calculates the markedness metric (PPV + NPV - 1), which is the predictive power analog of informedness/j_index (#27).
29+
* `roc_dist()` computes the Euclidean distance from the (sensitivity, specificity) point to the ideal point (1, 1) in ROC space. (#148)
3030

31-
* `metric_set()` now provides a more informative error message when `estimate` is not explicitly named for class/prob or survival metric sets. (#504)
31+
* `sedi()` computes the Symmetric Extremal Dependence Index, a prevalence-independent skill metric for binary classification that remains reliable at extreme class imbalance. (#630)
3232

33-
* Added `thresholds` argument to `roc_curve()` to allow for custom thresholds to calculate curves for. (#488)
33+
* `ranked_prob_score()` computes the ranked probability score for ordinal classification data. (#524)
3434

35-
* Speed up survival metrics performance. Some of this performance comes from slightly less strict input checking. (#576)
35+
* `weighted_interval_score()` is a new quantile metric. (#569)
36+
37+
## Improvements
3638

37-
* All metrics now have documented ranges of possible values in addition to what direction is the best. (#572)
39+
* Added checks to all metrics for the `na_rm` argument. (#349)
3840

39-
* The ranked probability score for ordinal classification data was added with `ranked_prob_score()`. (#524)
41+
* Added improved argument checking for metrics with additional arguments. (#519)
4042

41-
* Fixed bug where `brier_class()` returns NaN with extreme value case weights. (#614)
43+
* Added documentation pages for each metric type (e.g., `?class-metrics`, `?numeric-metrics`) listing all available metrics with their direction and range. (#547, #540)
4244

43-
* `poisson_log_loss()` has been enhanced to handle 0 valued estimates, no longer returning `Inf` or `NaN`. (#513)
45+
* All class metrics and probability metrics now include mathematical formulas in their documentation. (#605)
4446

45-
* Fixed bug where ranked probability metrics didn't work in combination with other classification metrics in `metric_set()`. (#539)
47+
* All metrics now document their valid range of output values. (#572)
4648

47-
* Added infrastructure for survival metrics on the linear predictor. (#551)
49+
* Documentation pages for metrics with alternate argument values now emphasize using `metric_tweak()` when building metric sets. (#626)
4850

49-
* Added infrastructure for quantile metrics. (#569)
51+
* Survival metrics performance has been improved. (#576)
5052

51-
* Added quantile metric `weighted_interval_score()`. (#569)
53+
* `brier_class()` has gained the `event_level` argument. (#515)
5254

53-
* Added checks to all metrics for `na_rm` argument. (#349)
55+
* `get_metrics()` has been added to return a `metric_set()` containing all metrics of a specified type. (#534)
5456

55-
* Removed crayon as a suggested package. (#574)
57+
* `metric_set()` now provides a more informative error message when `estimate` is not explicitly named for class/prob or survival metric sets. (#504)
5658

57-
* Added improved argument checking for metrics with additional arguments. (#519)
59+
* `roc_curve()` has gained a `thresholds` argument for specifying custom thresholds at which the curve is evaluated. (#488)
60+
61+
## Bug Fixes
62+
63+
* `brier_class()` no longer returns `NaN` with extreme value case weights. (#614)
64+
65+
* `classification_cost()` documentation now correctly refers to the `cost` column of the costs data frame. (#343)
66+
67+
* `mpe()` documentation now includes the formula and clarifies the interpretation of positive and negative values. (#345)
68+
69+
* `poisson_log_loss()` now handles 0-valued estimates without returning `Inf` or `NaN`. (#513)
70+
71+
* Fixed a bug where ranked probability metrics didn't work in combination with other classification metrics in `metric_set()`. (#539)
5872

5973
* Fixed documentation to show equations correctly. (#541)
6074

61-
* `fall_out()` and `miss_rate()` have been added to compute the false positive rate and false negative rate respectively (#336).
75+
## Developer
76+
77+
* Added infrastructure for quantile metrics. (#569)
78+
79+
* Added infrastructure for survival metrics on the linear predictor. (#551)
80+
81+
* `new_metric()` and related functions gain an optional `range` argument to store the valid output range of a metric. (#572)
82+
83+
* Removed crayon as a suggested package. (#574)
6284

6385
# yardstick 1.3.2
6486

R/aaa-new.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ metric_direction <- function(x) {
155155
metric_range <- function(x) {
156156
attr(x, "range", exact = TRUE)
157157
}
158+
metric_range_chr <- function(x, i) {
159+
val <- metric_range(x)[[i]]
160+
if (is.infinite(val)) paste0(if (val < 0) "-", "Inf") else as.character(val)
161+
}
158162
`metric_range<-` <- function(x, value) {
159163
attr(x, "range") <- value
160164
x

R/class-accuracy.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
#' \deqn{\text{Accuracy} = \frac{A + D}{A + B + C + D}}
2626
#'
2727
#' Accuracy is a metric that should be `r attr(accuracy, "direction")`d. The
28-
#' output ranges from `r metric_range(accuracy)[1]` to
29-
#' `r metric_range(accuracy)[2]`, with `r metric_optimal(accuracy)` indicating
28+
#' output ranges from `r metric_range_chr(accuracy, 1)` to
29+
#' `r metric_range_chr(accuracy, 2)`, with `r metric_optimal(accuracy)` indicating
3030
#' perfect predictions.
3131
#'
3232
#' @author Max Kuhn

R/class-bal_accuracy.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#'
2828
#' Balanced accuracy is a metric that should be
2929
#' `r attr(bal_accuracy, "direction")`d. The output ranges from
30-
#' `r metric_range(bal_accuracy)[1]` to `r metric_range(bal_accuracy)[2]`, with
30+
#' `r metric_range_chr(bal_accuracy, 1)` to `r metric_range_chr(bal_accuracy, 2)`, with
3131
#' `r metric_optimal(bal_accuracy)` indicating perfect predictions.
3232
#'
3333
#' @author Max Kuhn

R/class-detection_prevalence.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#'
2525
#' Detection prevalence is a metric that should be
2626
#' `r attr(detection_prevalence, "direction")`d. The output ranges from
27-
#' `r metric_range(detection_prevalence)[1]` to `r metric_range(detection_prevalence)[2]`.
27+
#' `r metric_range_chr(detection_prevalence, 1)` to `r metric_range_chr(detection_prevalence, 2)`.
2828
#' The "optimal" value depends on the true prevalence of positive events in the data.
2929
#'
3030
#' @author Max Kuhn

R/class-f_meas.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#' \deqn{F_{meas} = \frac{(1 + \beta^2) \cdot \text{Precision} \cdot \text{Recall}}{(\beta^2 \cdot \text{Precision}) + \text{Recall}}}
3737
#'
3838
#' F measure is a metric that should be `r attr(f_meas, "direction")`d. The
39-
#' output ranges from `r metric_range(f_meas)[1]` to
40-
#' `r metric_range(f_meas)[2]`, with `r metric_optimal(f_meas)` indicating
39+
#' output ranges from `r metric_range_chr(f_meas, 1)` to
40+
#' `r metric_range_chr(f_meas, 2)`, with `r metric_optimal(f_meas)` indicating
4141
#' perfect precision and recall.
4242
#'
4343
#' @references

R/class-fall_out.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
#' \deqn{\text{Fall-out} = \frac{B}{B + D}}
3636
#'
3737
#' Fall-out is a metric that should be `r attr(fall_out, "direction")`d. The
38-
#' output ranges from `r metric_range(fall_out)[1]` to
39-
#' `r metric_range(fall_out)[2]`, with `r metric_optimal(fall_out)` indicating
38+
#' output ranges from `r metric_range_chr(fall_out, 1)` to
39+
#' `r metric_range_chr(fall_out, 2)`, with `r metric_optimal(fall_out)` indicating
4040
#' that all actual negatives were correctly predicted as negative (no false
4141
#' positives).
4242
#'

R/class-j_index.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#' \deqn{\text{J-index} = \text{Sensitivity} + \text{Specificity} - 1}
2323
#'
2424
#' J-index is a metric that should be `r attr(j_index, "direction")`d. The
25-
#' output ranges from `r metric_range(j_index)[1]` to
26-
#' `r metric_range(j_index)[2]`, with `r metric_optimal(j_index)` indicating no
25+
#' output ranges from `r metric_range_chr(j_index, 1)` to
26+
#' `r metric_range_chr(j_index, 2)`, with `r metric_optimal(j_index)` indicating no
2727
#' false positives and no false negatives.
2828
#'
2929
#' The binary version of J-index is equivalent to the binary concept of

0 commit comments

Comments
 (0)