construct_tuners: Construct a list of tuning grids for hyperparameter tuning...

View source: R/construct_tuners.R

construct_tunersR Documentation

Construct a list of tuning grids for hyperparameter tuning predictive models

Description

Construct a list of tuning grids for hyperparameter tuning predictive models

Usage

construct_tuners(
  roadmap,
  default_regression_tuner = NULL,
  default_classification_tuner = NULL,
  custom_tuners = NULL
)

Arguments

roadmap

A roadmap object

default_regression_tuner

A tuner.

default_classification_tuner

A tuner.

custom_tuners

A formatted list of tuners.

Value

A named list of tuners

Examples


# construct_tuners() can create a sequence of tuners using a fully-default 
# approach, a hybrid approach, or a fully-customized approach. All approaches
# require a roadmap and tuners. 

rm <- roadmap(
  conf_data = acs_conf_nw,
  start_data = acs_start_nw
)

tuner_reg <- list(
  v = 3,
  grid = 3,
  metrics = yardstick::metric_set(yardstick::rmse)
)

tuner_cat <- list(
  v = 3,
  grid = 3,
  metrics = yardstick::metric_set(yardstick::roc_auc)
)

# Fully-default approach

construct_tuners(
  roadmap = rm, 
  default_regression_tuner = tuner_reg,
  default_classification_tuner = tuner_cat
)

# Hybrid approach

tuner_cat2 <- list(
  v = 3,
  grid = 3,
  metrics = yardstick::metric_set(yardstick::precision)
)

construct_tuners(
  roadmap = rm, 
  default_regression_tuner = tuner_reg,
  default_classification_tuner = tuner_cat,
  custom_tuners = list(
    list(vars = "hcovany", tuner = tuner_cat2)
  )
)

# Fully-customized approach

construct_tuners(
  roadmap = rm, 
  custom_tuners = list(
    list(vars = c("hcovany", "empstat", "classwkr"), tuner = tuner_reg),
    list(vars = c("age", "famsize", "transit_time", "inctot"), tuner = tuner_cat)
  )
)


tidysynthesis documentation built on March 17, 2026, 1:06 a.m.