Compute classification boundaries for a workflow_set
Source:R/boundary_workflow_set.R
boundary_workflow_set.RdA dedicated helper to automatically fit and extract classification boundaries
for an entire workflow_set. This avoids the need for manual iteration over models.
Arguments
- wf_set
A
workflow_setobject from theworkflowsetspackage.- data
A data frame containing the training data. This is required to extract feature metadata and to fit any workflows that are not yet trained.
- feature_range
An optional named list specifying the minimum and maximum values for each feature, or a character vector of feature names. If
NULL, the ranges are automatically computed from the training data (if there are exactly 2 numeric features).- response
A string specifying the name of the response column in
data.- resolution
An integer specifying the number of points along each axis (default = 100).
- ...
Additional arguments passed to
boundary_compute().
Value
A data frame containing the combined boundary grid for all models, with a model column
indicating the wflow_id.
Examples
# \donttest{
library(palmerpenguins)
library(workflowsets)
library(parsnip)
data(penguins)
peng_data <- na.omit(penguins[, c("species", "bill_length_mm", "bill_depth_mm")])
# Define multiple engines
spec_rpart <- decision_tree() |>
set_engine("rpart") |>
set_mode("classification")
spec_glm <- multinom_reg() |>
set_engine("nnet") |>
set_mode("classification")
# Create a workflow set
wf_set <- workflow_set(
preproc = list(base = species ~ bill_length_mm + bill_depth_mm),
models = list(tree = spec_rpart, log_reg = spec_glm)
)
# Compute 2D boundaries for all models simultaneously (auto-range)
bounds <- boundary_workflow_set(wf_set, peng_data, response = "species", resolution = 30)
# }