Skip to content

This object has the results when a CART classification tree model was tuned over the cost-complexity parameter using racing.

Value

An object with primary class tune_race.

Details

To reduce the object size, a smaller subset of the data were used.

The code used to produce this object:

library(tidymodels)
  library(finetune)
  tidymodels_prefer()

  ctrl_rc <- control_race(save_pred = TRUE)

  # ------------------------------------------------------------------------------

  data(cells)

  set.seed(1)
  cells <-
    cells %>%
    select(-case) %>%
    sample_n(200)

  # ------------------------------------------------------------------------------

  set.seed(2)
  cell_rs <- vfold_cv(cells)

  # ------------------------------------------------------------------------------

  set.seed(3)
  cell_race <-
    decision_tree(cost_complexity = tune()) %>%
    set_mode("classification") %>%
    tune_race_anova(
      class ~ .,
      resamples = cell_rs,
      grid = tibble(cost_complexity = 10^seq(-2, -1, by = 0.2)),
      control = ctrl_rc
    )