Skip to content

Commit

Permalink
add sections on data usage for each adjustment (closes #35)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Sep 13, 2024
1 parent 8eee497 commit a316bb2
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 1 deletion.
7 changes: 7 additions & 0 deletions R/adjust-equivocal-zone.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
#' @param value A numeric value (between zero and 1/2) or [hardhat::tune()]. The
#' value is the size of the buffer around the threshold.
#' @param threshold A numeric value (between zero and one) or [hardhat::tune()].
#'
#' @section Data Usage:
#' This adjustment doesn't require estimation and, as such, the same data that's
#' used to train it with `fit()` can be predicted on with `predict()`; fitting
#' this adjustment just collects metadata on the supplied column names and does
#' not risk data leakage.
#'
#' @examplesIf rlang::is_installed("modeldata")
#' library(modeldata)
#'
Expand Down
15 changes: 15 additions & 0 deletions R/adjust-numeric-calibration.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#' Re-calibrate numeric predictions
#'
#' @description
#' Calibration for regression models involves adjusting the model's
#' predictions to adjust for correlated errors, ensuring that predicted
#' values align closely with actual observed values across the entire
#' range of outputs.
#'
#' @param x A [tailor()].
#' @param method Character. One of `"linear"`, `"isotonic"`, or
#' `"isotonic_boot"`, corresponding to the function from the \pkg{probably}
#' package [probably::cal_estimate_linear()],
#' [probably::cal_estimate_isotonic()], or
#' [probably::cal_estimate_isotonic_boot()], respectively.
#'
#' @section Data Usage:
#' This adjustment requires estimation and, as such, different subsets of data
#' should be used to train it and evaluate its predictions. See the section
#' by the same name in [workflows::add_tailor()] for more information on
#' preventing data leakage with postprocessors that require estimation. When
#' situated in a workflow, tailors will automatically be estimated with
#' appropriate subsets of data.
#'
#' @examples
#' library(tibble)
#'
Expand Down
2 changes: 2 additions & 0 deletions R/adjust-numeric-range.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#' @param upper_limit,lower_limit A numeric value, NA (for no truncation) or
#' [hardhat::tune()].
#'
#' @inheritSection adjust_equivocal_zone Data Usage
#'
#' @examplesIf FALSE
# # TODO: unskip -- fn currently requires estimate to be called `.pred` (#22)
#' library(tibble)
Expand Down
3 changes: 3 additions & 0 deletions R/adjust-predictions-custom.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#' @param .pkgs A character string of extra packages that are needed to execute
#' the commands.
#' @param ... Name-value pairs of expressions. See [dplyr::mutate()].
#'
#' @inheritSection adjust_equivocal_zone Data Usage
#'
#' @examplesIf rlang::is_installed("modeldata")
#' library(modeldata)
#'
Expand Down
2 changes: 2 additions & 0 deletions R/adjust-probability-calibration.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#' function from the \pkg{probably} package [probably::cal_estimate_logistic()],
#' [probably::cal_estimate_multinomial()], etc., respectively.
#'
#' @inheritSection adjust_numeric_calibration Data Usage
#'
# TODO: see #36
#' @examplesIf FALSE
# @examplesIf rlang::is_installed("modeldata")
Expand Down
3 changes: 3 additions & 0 deletions R/adjust-probability-threshold.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#'
#' @param x A [tailor()].
#' @param threshold A numeric value (between zero and one) or [hardhat::tune()].
#'
#' @inheritSection adjust_equivocal_zone Data Usage
#'
#' @examplesIf rlang::is_installed("modeldata")
#' library(modeldata)
#'
Expand Down
8 changes: 8 additions & 0 deletions man/adjust_equivocal_zone.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion man/adjust_numeric_calibration.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/adjust_numeric_range.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/adjust_predictions_custom.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions man/adjust_probability_calibration.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/adjust_probability_threshold.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a316bb2

Please sign in to comment.