R/extract_fit_time.R

Defines functions extract_fit_time.recipe

#' @export
extract_fit_time.recipe <- function(x, summarize = TRUE, ...) {
  res <- x$fit_times

  if (is.null(res)) {
    cli::cli_abort(
      "This recipe was created before {.fn recipes::extract_fit_time} was \\
      added. Fit time cannot be extracted."
    )
  }

  if (summarize) {
    res <- tibble(
      stage_id = "recipe",
      elapsed = sum(res$elapsed)
    )
  }

  res
}
tidymodels/recipes documentation built on Nov. 29, 2024, 3:05 p.m.