tidymodels / tailor

Iterative Steps for Postprocessing Model Predictions

Home Page:https://tailor.tidymodels.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`train` vs `fit`

simonpcouch opened this issue · comments

The method to fit a tailor is called fit() and a new helper function calls that operation fitting:

tailor/R/utils.R

Lines 76 to 81 in e98131d

#' @export
#' @keywords internal
#' @rdname tailor-internals
tailor_requires_fit <- function(x) {
any(purrr::map_lgl(x$operations, tailor_operation_requires_fit))
}

At the same time, some other functionality (printing, the slot $trained, the following helper) uses train:

tailor/R/utils.R

Lines 64 to 70 in e98131d

tailor_fully_trained <- function(x) {
if (length(x$operations) == 0L) {
return(FALSE)
}
all(purrr::map_lgl(x$operations, tailor_operation_trained))
}

train follows the precedent of recipes::fully_trained(), print methods elsewhere, etc. I'm not sure if this might be a point of confusion for users.

I'm wondering if we should differentiate between "trained", "untrained", and "n/a". The last case is things like probability thresholding that don't estimate anything.

The requires_fit slot can help us tell which operations don't estimate anything!