Skip to content

For some postprocessors, enable simple application of adjustments #273

@topepo

Description

@topepo

If a tailor object has not tuning parameters or estimation, we should have an API that let's us just push predictions through.

fit.action_tailor() is where the columns names. are set. However, we can update the tailor objects with that information from the workflow.

For example:

get_output_columns <- function(x, syms = FALSE) {
  mod_res <- extract_fit_parsnip(x)
  mod_mode <- mod_res %>% purrr::pluck("spec") %>% purrr::pluck("mode")

  if (mod_mode == "regression") {
    res <- list(estimate = ".pred", probabilities = character(0))
  } else if (mod_mode == "classification") {
    res <-
      list(
        estimate = ".pred_class",
        probabilities = paste0(".pred_", mod_res$lvl)
      )
  } else {
    cli::cli_abort("Unsupported model mode: {mod_mode}")
  }
  res <- c(list(outcome = outcome_names(x)), res)

  if (syms) {
    res <- purrr::map(res, rlang::syms)
  }
  res
}

could be used to populate the columns.

The reason for this is that the tune package will have to step through an unneeded loop and have a loft of redundant computations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions