Skip to content

Instantly share code, notes, and snippets.

@simonpcouch
Created September 26, 2022 17:58
Show Gist options
  • Save simonpcouch/dcb7de3251fb3e22a7445d2c776f5465 to your computer and use it in GitHub Desktop.
Save simonpcouch/dcb7de3251fb3e22a7445d2c776f5465 to your computer and use it in GitHub Desktop.

Proposed modifications to the internals of tune:::check_grid.


  tune_tbl <- tune_args(workflow)
  tune_params <- tune_tbl$id

  if (nrow(pset) == 0L) {
    msg <- c("!" = "No tuning parameters have been detected; performance will be
                    evaluated using the resamples with no tuning.")

    if (isTRUE(nrow(tune_tbl) > 0)) {
      from_model <- all(tune_tbl$source == "model_spec")
      engine <- extract_spec_parsnip(workflow)$engine
      engine_snippet <- paste0(' with the specified engine "', engine, '"')
      msg <-
        c(msg,
          i = "{cli::qty(tune_params)}The parameter{?s} {.var {tune_params}} {?was/were}
               marked with `tune()`, though {?is/are} not supported for
               tuning{if (from_model) engine_snippet}.")
    } else {
      msg <- c(msg, "i" = "Did you want to `tune()` parameters?")
    }

    cli::cli_warn(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment