Skip to content

Commit 7c49991

Browse files
committed
document fit() and predict() methods (closes #34)
1 parent a3f3581 commit 7c49991

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

R/tailor.R

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,29 @@ print.tailor <- function(x, ...) {
127127
invisible(x)
128128
}
129129

130+
#' Fit and predict from tailors
131+
#'
132+
#' @description
133+
#' These functions apply `fit()` and `predict()` methods for each adjustment
134+
#' added to a tailor, in the order in which they were applied.
135+
#'
136+
#' Users do not need to interface with these methods directly when tailors
137+
#' are situated inside model workflows with [workflows::add_tailor()].
138+
#'
139+
#' @section Data Usage:
140+
#'
141+
#' For adjustments that don't require estimating parameters, training with
142+
#' `fit()` simply evaluates tidyselect expressions and logs column names.
143+
#' For others, as in [adjust_numeric_calibration()], adjustments actually
144+
#' learn from data; in that case, separate subsets of data ought to be used
145+
#' for training the tailor and evaluating its performance on predictions.
146+
#' See the Data Usage section in [workflows::add_tailor()] for more information
147+
#' on how tidymodels makes that split; when situated in a model workflow,
148+
#' tailors will automatically be trained on the appropriate subset of data.
149+
#'
150+
#' @param .data,new_data A data frame containing predictions from a model.
151+
#' @inheritParams tailor
152+
#'
130153
#' @export
131154
fit.tailor <- function(object, .data, outcome, estimate, probabilities = c(),
132155
...) {
@@ -170,6 +193,7 @@ fit.tailor <- function(object, .data, outcome, estimate, probabilities = c(),
170193
object
171194
}
172195

196+
#' @rdname fit.tailor
173197
#' @export
174198
predict.tailor <- function(object, new_data, ...) {
175199
# validate levels/classes

man/fit.tailor.Rd

Lines changed: 50 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)