Many Models, One Question
Techniques:
Guidelines:
Modalities:
The one idea
No single algorithm is right in advance. Fit several that explain the outcome in different mathematical ways, compare them on identical resamples, and let the evidence, then the intended use, choose.
Kuhn and Johnson make this the backbone of Applied Predictive Modeling1. Their worked case studies do not pick an algorithm and tune it to death. They fit a panel: linear, nonlinear, tree-based, kernel-based. They compare the resampled performance distributions and only then decide. Judging a model by how well it predicts held-out data, rather than by how plausible its assumptions look, is what Leo Breiman called the algorithmic modelling culture2. The reason is not fashion. Each model makes different assumptions about how predictors relate to the outcome, so a panel is a set of competing hypotheses about the data.

Eight models, eight explanations
Product T, from reading 1: predict % dissolved at 30 minutes from material and process data.
| Model | How it explains the outcome | What it assumes | Preprocessing it needs |
|---|---|---|---|
| Partial least squares (PLS) | A weighted sum of a few latent variables chosen to covary with y | Roughly linear; collinearity is fine | Centring, usually scaling |
| Penalized regression (lasso, elastic net) | A weighted sum of predictors with coefficients shrunk toward zero; lasso sets some exactly to zero | Linear, additive | Scaling (the penalty is scale-dependent) |
| MARS | Joined straight-line segments (“hinges”), with interactions added automatically | Piecewise linear | Little |
| Support vector machine (radial kernel) | A smooth surface in a transformed space, ignoring errors inside a tolerance band | Smooth, possibly curved | Scaling, essential |
| k-nearest neighbours | The average of the k most similar training batches | Similar inputs give similar outputs | Scaling, essential (it is all distances) |
| Random forest | The average of hundreds of decision trees, each grown on a bootstrap sample with random subsets of predictors | Step-like relationships; interactions are natural | Almost none |
| Boosted trees | Many shallow trees, each fitted to the errors of the trees before it | Same as forest, built sequentially | Almost none |
| Neural network (single hidden layer) | Weighted sums passed through nonlinear functions, layered | Very flexible; needs data | Scaling, essential |
Three practical consequences follow from the table.
- Different preprocessing for different models. Trees need almost nothing; KNN, SVM and neural networks are useless without scaling. tidymodels handles this by pairing recipes with models.
- Different extrapolation behaviour. A tree ensemble cannot predict outside the range of outcomes it was trained on; it plateaus. A linear model extrapolates confidently, and can be confidently wrong. Neither is safe outside the applicability domain, which is why T² and Q monitoring matter regardless of model.
- Different explanations. If PLS, the lasso and a random forest all rank API particle size first, that is evidence about the data. If only the neural network finds a signal, ask what it is fitting.
Run the panel on the same resamples
A workflow joins one recipe to one model. A workflow set crosses several recipes with several models:
library(tidymodels)
basic <- recipe(diss_30 ~ ., data = batches) |>
update_role(batch_id, api_lot, new_role = "id") |>
step_impute_median(hardness) |>
step_dummy(all_nominal_predictors()) |>
step_nzv(all_predictors())
scaled <- basic |> step_normalize(all_numeric_predictors())
panel <- workflow_set(
preproc = list(basic = basic, scaled = scaled),
models = list(
pls = parsnip::pls(num_comp = tune()) |> set_mode("regression"),
lasso = linear_reg(penalty = tune(), mixture = 1) |> set_engine("glmnet"),
mars = mars(prod_degree = tune()) |> set_mode("regression"),
svm = svm_rbf(cost = tune(), rbf_sigma = tune()) |> set_mode("regression"),
knn = nearest_neighbor(neighbors = tune()) |> set_mode("regression"),
forest = rand_forest(mtry = tune(), trees = 1000) |> set_mode("regression"),
boost = boost_tree(trees = tune(), learn_rate = tune()) |> set_mode("regression"),
nnet = mlp(hidden_units = tune(), penalty = tune()) |> set_mode("regression")
)
)
results <- panel |>
workflow_map("tune_grid", resamples = folds, grid = 15,
metrics = metric_set(rmse, rsq), seed = 2026)
autoplot(results, rank_metric = "rmse")
In practice you would pair the tree models with basic and the rest with scaled instead of fitting every combination. The point to see is the structure: one folds object (the batch-grouped folds from reading 1), used by every workflow. Each model is scored on exactly the same held-out batches, so the comparison is paired. Differences come from the models, not from luck in the split.
Read the result as a distribution, not a leaderboard
The constructed Product T panel gives these cross-validated RMSE values, in % dissolved:
| Model | Mean RMSE | Spread across folds |
|---|---|---|
| Random forest | 3.1 | 2.4–3.9 |
| Boosted trees | 3.2 | 2.3–4.2 |
| MARS | 3.3 | 2.6–4.0 |
| PLS | 3.4 | 2.8–4.1 |
| Lasso | 3.5 | 2.9–4.1 |
| SVM | 3.6 | 2.7–4.6 |
| Neural network | 4.0 | 2.9–5.6 |
| KNN | 4.4 | 3.3–5.8 |
The forest “wins” by 0.3 percentage points. The spread across folds is about 1.5 points. The top five are not meaningfully different on this evidence. Kuhn and Silge recommend formal paired comparisons of resampled metrics for exactly this reason3. Two things are clear: KNN and the neural network are worse, and the relationships appear to be mostly linear, since PLS and the lasso keep up with the flexible models.
The one-standard-error rule
When several settings perform within noise of each other, choose the simplest one within one standard error of the best. tune provides select_by_one_std_err(). In a regulated setting this rule has more force, because the simpler model is easier to explain, validate, monitor and transfer. Here PLS or the lasso is the defensible choice. The forest’s 0.3 points do not pay for what it costs to justify.
Ensembles: let models vote
Sometimes the models are wrong in different places. Then a combination beats any member. Stacking fits a second, simple model whose inputs are the out-of-fold predictions of the candidates, and learns how much weight each deserves3:
library(stacks)
ens <- stacks() |>
add_candidates(results) |> # out-of-fold predictions from the panel
blend_predictions() |> # penalized weights; most get zero
fit_members() # refit the survivors on all training data
add_candidates needs the tuning run to keep its predictions (control_grid(save_pred = TRUE, save_workflow = TRUE)). The blending step uses a lasso-type penalty, so most candidates get zero weight; a typical result keeps two to four members. Random forests and boosted trees are themselves ensembles of trees. Stacking is the same idea one level up.
For Product T the stack (PLS 0.55, random forest 0.30, MARS 0.15) reaches RMSE 2.9. Is that worth it? An ensemble is several locked models plus a blending model, each with its own preprocessing. Every one has to be validated, monitored for drift and change-controlled. Ensembles are common in research and in high-volume, low-consequence prediction. For a model that supports a release decision, the extra 0.5 points must be weighed against that lifecycle burden.
What the panel tells you that one model cannot
- Is the problem linear? If PLS keeps up with the forest, yes, mostly.
- Is there more signal to find? If every model plateaus near the same error, the limit is the data, not the algorithm. Compare the plateau with the reference method’s own noise. In Product T, vessel-to-vessel SD is about 3%, so a six-vessel batch mean carries roughly 1.2 points of noise, and run-to-run variation adds a little more. Every model stalls near 3, well above that floor. Something that drives dissolution is either not in the table or not varying enough in it to be learned.
- Do the explanations agree? Variable importance from different model families that agrees is stronger evidence than one model’s ranking.
None of this establishes cause. Every model here learns associations in historical batches. Reading 3 is about that limit.
Where the analyst sits
The analyst sets the comparison up honestly (same folds, grouped the way the model will be used) and reads the result as a distribution. They also know the error floor set by the reference method, and choose the simplest model the evidence supports. The final choice is a judgment about intended use, consequence and lifecycle cost, not a sort by RMSE.

The reading on one page

For discussion
- Why must every model in the panel use the same resampling object?
- The neural network has the widest spread across folds. Give two reasons a flexible model might be unstable with 60 batches.
- A random forest is trained on batches with 70–90% dissolved. What does it predict for a batch whose true value is 60%? What does PLS predict?
- Make the case for and against deploying the three-member stack for in-process prediction. Then do the same for release.
Bridge back to the week
Next: Correlation Is Not Causation. Return to Week 12.
Sources
Product T and the panel results are constructed for teaching.
M. Kuhn and K. Johnson, Applied Predictive Modeling (Springer, 2013). Chapters 6–9 for the regression models; Chapter 10 compares a full model panel on one case study. DOI. ↩︎
L. Breiman, “Statistical Modeling: The Two Cultures,” Statistical Science 16(3) (2001) 199–231. The classic argument for judging models by predictive accuracy, with replies from statisticians who disagree. DOI. ↩︎
M. Kuhn and J. Silge, Tidy Modeling with R (O’Reilly, 2022). Chapter 11 on comparing models with resampling, Chapter 15 on workflow sets, Chapter 20 on ensembles and the stacks package. Free online at tmwr.org. ↩︎ ↩︎