Skip to content

Commit a316bb2

Browse files
committed
add sections on data usage for each adjustment (closes #35)
1 parent 8eee497 commit a316bb2

12 files changed

+88
-1
lines changed

R/adjust-equivocal-zone.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
#' @param value A numeric value (between zero and 1/2) or [hardhat::tune()]. The
1010
#' value is the size of the buffer around the threshold.
1111
#' @param threshold A numeric value (between zero and one) or [hardhat::tune()].
12+
#'
13+
#' @section Data Usage:
14+
#' This adjustment doesn't require estimation and, as such, the same data that's
15+
#' used to train it with `fit()` can be predicted on with `predict()`; fitting
16+
#' this adjustment just collects metadata on the supplied column names and does
17+
#' not risk data leakage.
18+
#'
1219
#' @examplesIf rlang::is_installed("modeldata")
1320
#' library(modeldata)
1421
#'

R/adjust-numeric-calibration.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
#' Re-calibrate numeric predictions
22
#'
3+
#' @description
4+
#' Calibration for regression models involves adjusting the model's
5+
#' predictions to adjust for correlated errors, ensuring that predicted
6+
#' values align closely with actual observed values across the entire
7+
#' range of outputs.
8+
#'
39
#' @param x A [tailor()].
410
#' @param method Character. One of `"linear"`, `"isotonic"`, or
511
#' `"isotonic_boot"`, corresponding to the function from the \pkg{probably}
612
#' package [probably::cal_estimate_linear()],
713
#' [probably::cal_estimate_isotonic()], or
814
#' [probably::cal_estimate_isotonic_boot()], respectively.
15+
#'
16+
#' @section Data Usage:
17+
#' This adjustment requires estimation and, as such, different subsets of data
18+
#' should be used to train it and evaluate its predictions. See the section
19+
#' by the same name in [workflows::add_tailor()] for more information on
20+
#' preventing data leakage with postprocessors that require estimation. When
21+
#' situated in a workflow, tailors will automatically be estimated with
22+
#' appropriate subsets of data.
23+
#'
924
#' @examples
1025
#' library(tibble)
1126
#'

R/adjust-numeric-range.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#' @param upper_limit,lower_limit A numeric value, NA (for no truncation) or
1212
#' [hardhat::tune()].
1313
#'
14+
#' @inheritSection adjust_equivocal_zone Data Usage
15+
#'
1416
#' @examplesIf FALSE
1517
# # TODO: unskip -- fn currently requires estimate to be called `.pred` (#22)
1618
#' library(tibble)

R/adjust-predictions-custom.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#' @param .pkgs A character string of extra packages that are needed to execute
88
#' the commands.
99
#' @param ... Name-value pairs of expressions. See [dplyr::mutate()].
10+
#'
11+
#' @inheritSection adjust_equivocal_zone Data Usage
12+
#'
1013
#' @examplesIf rlang::is_installed("modeldata")
1114
#' library(modeldata)
1215
#'

R/adjust-probability-calibration.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#' function from the \pkg{probably} package [probably::cal_estimate_logistic()],
1414
#' [probably::cal_estimate_multinomial()], etc., respectively.
1515
#'
16+
#' @inheritSection adjust_numeric_calibration Data Usage
17+
#'
1618
# TODO: see #36
1719
#' @examplesIf FALSE
1820
# @examplesIf rlang::is_installed("modeldata")

R/adjust-probability-threshold.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#'
1313
#' @param x A [tailor()].
1414
#' @param threshold A numeric value (between zero and one) or [hardhat::tune()].
15+
#'
16+
#' @inheritSection adjust_equivocal_zone Data Usage
17+
#'
1518
#' @examplesIf rlang::is_installed("modeldata")
1619
#' library(modeldata)
1720
#'

man/adjust_equivocal_zone.Rd

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/adjust_numeric_calibration.Rd

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/adjust_numeric_range.Rd

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/adjust_predictions_custom.Rd

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)