Stacked regressions

LEO BREIMAN

article2004Machine-mediated learning1,413 citations

Demonstrates how combining multiple regression models using cross-validation under non-negativity constraints reliably outperforms single-model selection across diverse algorithms like decision trees, subset selection, and ridge regression.

Listen

In predictive modeling, practitioners traditionally evaluate a range of competing models and select the single best performer using holdout validation or cross-validation. However, choosing only one model discards valuable information present in alternative predictors and risks poor generalization when models are sensitive to sample variations. The article addresses this limitation by developing stacked regressions, a method for forming linear combinations of different predictors to achieve superior prediction accuracy compared to any individual model.

The article establishes and evaluates a practical framework that uses cross-validated predictions paired with least squares estimation constrained by non-negative weights to determine the combination coefficients. The approach was tested across real-world datasets and extensive computer simulations. Specifically, the analysis evaluated decision trees using the Boston Housing and Ozone datasets, alongside 250 simulation runs involving 40 variables and 60 observations across varied correlation structures to test subset regressions, ridge regressions, and their combinations.

The findings show that stacked regressions consistently outperform the single best model chosen by cross-validation. On the real-world housing and ozone datasets, stacking regression trees reduced prediction error by approximately 10%. In linear simulations, stacking subset regressions and ridge regressions together delivered substantial reductions in model error, outperforming the best-of-best single model selection across all evaluated scenarios. Additionally, the analysis revealed that only a small number of predictors receive positive weights—typically around 3 to 7 models out of dozens—and that 10-fold cross-validation is not only computationally faster than leave-one-out cross-validation but also yields slightly better predictive accuracy.

These results demonstrate that combining diverse predictive models provides greater accuracy and stability than relying on a single selected model. The greatest performance gains occur when combining dissimilar model types, such as subset selection with regularized models, because differing models capture complementary patterns in data. In organizational settings, shifting from single-model selection to stacked combinations can improve decision performance and mitigate model-selection risk without requiring unconstrained, complex combinations that risk overfitting.

Organizations and practitioners should adopt stacked regression with non-negativity constraints when selecting among diverse model candidates. For implementation efficiency, teams should use 10-fold cross-validation rather than leave-one-out methods. While the empirical and simulation evidence strongly supports the method, the article notes that general mathematical proofs are not yet complete, and stacking yields minimal gains when combining highly similar models. Additional evaluation is warranted when applying the approach to other model families such as neural networks or spline-based models.

BREIMAN (2004).pdf
  • Paper: Bagging Predictors, Leo Breiman (1996). Introduces bootstrap aggregation (bagging) to reduce predictor variance, providing essential foundational context for ensemble model combination methods.
  • Paper: Regression Shrinkage and Selection Via the Lasso, Robert Tibshirani (1996). Establishes constrained regularized regression techniques that underly the non-negativity and shrinkage constraints used when combining predictors in stacked regressions.
  • Paper: A Study of Cross-Validation and Bootstrap for Accuracy Estimation and Model Selection, Ron Kohavi (1995). Provides a comprehensive analysis of cross-validation methodology, which is the core mechanism used in stacked regressions to form out-of-fold predictions and prevent overfitting.
  • Paper: Greedy function approximation: A gradient boosting machine, Jerome H. Friedman (2001). Presents gradient boosting as an alternative framework for ensembling decision trees and regression models through stagewise optimization.
  • Paper: Random Forests, Leo Breiman (2001). Details the random forest paradigm for aggregating randomized regression and classification trees, contrasting simple averaging with meta-learning combinations.
Cover for Stacked regressions

Abstract

Stacking regressions is a method for forming linear combinations of different predictors to give improved prediction accuracy. The idea is to use cross-validation data and least squares under non-negativity constraints to determine the coefficients in the combination. Its effectiveness is demonstrated in stacking regression trees of different sizes and in a simulation stacking linear subset and ridge regressions. Reasons why this method works are explored. The idea of stacking originated with Wolpert (1992).

Table of Contents

  • 1. Introduction
  • 2. Why Non-negativity Constraints Work
  • 3. Stacking Trees
  • 4. Description of the Linear Regression Simulation
  • 5. Stacking Subset Regressions
  • 6. Stacking Ridge Regression
  • 7. Stacking Subset Selection With Ridge
  • 8. Computational Efficiency and J-Fold Cross-Validation
  • 9. Remarks
  • 10. Conclusions
  • References

Knowls

  1. Knowl 1 — Stacked Regression with Non-Negative Least Squares

    model/method

    Stacked regression combines KK predictors v1(x),…,vK(x)v_1(x), \ldots, v_K(x) of a continuous response y∈Ry \in \mathbb{R} from an input vector x∈RMx \in \mathbb{R}^M, constructed from a training dataset L={(yn,xn)}n=1N\mathcal{L} = \{(y_n, x_n)\}_{n=1}^N. To avoid overfitting and collinearity instabilities inherent in unconstrained least squares combinations, stacking uses cross-validation predictions (level-one data) subject to non-negativity constraints.

    The training data L\mathcal{L} is split into JJ folds L1,…,LJ\mathcal{L}_1, \ldots, \mathcal{L}_J. For each fold j∈{1,…,J}j \in \{1, \ldots, J\}, base predictors vk(j)(x)v_k^{(j)}(x) are trained on the out-of-fold data L(−j)=L∖Lj\mathcal{L}^{(-j)} = \mathcal{L} \setminus \mathcal{L}_j. For each sample (yn,xn)∈Lj(y_n, x_n) \in \mathcal{L}_j, the level-one feature vector zn=(z1n,…,zKn)Tz_n = (z_{1n}, \ldots, z_{Kn})^T is constructed with: zkn=vk(j)(xn)z_{kn} = v_k^{(j)}(x_n) When J=NJ = N, this corresponds to leave-one-out cross-validation: zkn=vk(−n)(xn)z_{kn} = v_k^{(-n)}(x_n).

    The stacking combination coefficients α=(α1,…,αK)T\alpha = (\alpha_1, \ldots, \alpha_K)^T are determined by solving the non-negative least squares problem over the level-one data: min⁡α1,…,αK∑n=1N(yn−∑k=1Kαkzkn)2subject toαk≥0for k=1,…,K\min_{\alpha_1, \ldots, \alpha_K} \sum_{n=1}^N \left( y_n - \sum_{k=1}^K \alpha_k z_{kn} \right)^2 \quad \text{subject to} \quad \alpha_k \ge 0 \quad \text{for } k = 1, \ldots, K

    The final stacked predictor evaluated on any new input vector xx is: v(x)=∑k=1Kαkvk(x)v(x) = \sum_{k=1}^K \alpha_k v_k(x) where each vk(x)v_k(x) is the predictor trained on the full training set L\mathcal{L}.

  2. Knowl 2 — Condition for Single Predictor Optimality over Stacking

    theoretical result

    Let RR be the K×KK \times K residual cross-product matrix among KK predictors v1,…,vKv_1, \ldots, v_K on response data yy, with elements: Rij=∑n=1N(yn−vi(xn))(yn−vj(xn))R_{ij} = \sum_{n=1}^N (y_n - v_i(x_n))(y_n - v_j(x_n)) Suppose combination coefficients α=(α1,…,αK)T\alpha = (\alpha_1, \ldots, \alpha_K)^T are chosen to minimize αTRα\alpha^T R \alpha subject to non-negativity (αk≥0\alpha_k \ge 0) and the convex combination constraint (∑k=1Kαk=1\sum_{k=1}^K \alpha_k = 1). Let vkv_k be the single predictor with minimal residual sum of squares, such that Rkk=min⁡jRjjR_{kk} = \min_{j} R_{jj}.

    The best single predictor vkv_k is identical to the optimal stacked combination if and only if: Rkk≤Rikfor all i=1,…,KR_{kk} \le R_{ik} \quad \text{for all } i = 1, \ldots, K

    Equivalently, letting ρik\rho_{ik} denote the sample correlation between the residual vectors of predictor ii and predictor kk, and letting σi,σk\sigma_i, \sigma_k denote their respective residual standard deviations, this condition is: σkσi≤ρikfor all i=1,…,K\frac{\sigma_k}{\sigma_i} \le \rho_{ik} \quad \text{for all } i = 1, \ldots, K

    Consequently, if an alternative candidate predictor viv_i achieves residual error comparable to vkv_k (i.e., σi≈σk\sigma_i \approx \sigma_k), the best single predictor cannot outperform or match stacking unless its residuals are almost perfectly correlated with vkv_k (ρik≈1\rho_{ik} \approx 1), implying that vi(x)≈vk(x)v_i(x) \approx v_k(x).

  3. Knowl 3 — Implicit Sum-to-One Property of Non-Negative Stacking Weights

    theoretical result

    In stacked regression with non-negativity constraints αk≥0\alpha_k \ge 0, an explicit sum-to-one constraint ∑k=1Kαk=1\sum_{k=1}^K \alpha_k = 1 is mathematically and empirically unnecessary when accurate base predictors are present.

    Let α=(α1,…,αK)T\alpha = (\alpha_1, \ldots, \alpha_K)^T be the unconstrained non-negative minimizer of ∑n=1N(yn−∑kαkvk(xn))2\sum_{n=1}^N (y_n - \sum_k \alpha_k v_k(x_n))^2, let s=∑k=1Kαks = \sum_{k=1}^K \alpha_k, and define the normalized combination predictor v∗(x)=∑k=1K(αk/s)vk(x)v^*(x) = \sum_{k=1}^K (\alpha_k / s) v_k(x) and unnormalized predictor v(x)=sv∗(x)=∑k=1Kαkvk(x)v(x) = s v^*(x) = \sum_{k=1}^K \alpha_k v_k(x). Using the sample Euclidean norm ∥u∥=∑n=1Nun2\|u\| = \sqrt{\sum_{n=1}^N u_n^2}, the sum of weights ss satisfies: ∥y∥−∥y−v∥∥y∥+∥y−v∗∥≤s≤∥y∥+∥y−v∥∥y∥−∥y−v∗∥\frac{\|y\| - \|y - v\|}{\|y\| + \|y - v^*\|} \le s \le \frac{\|y\| + \|y - v\|}{\|y\| - \|y - v^*\|}

    When at least one base predictor in the ensemble fits the target reasonably well, the residual norms ∥y−v∥\|y - v\| and ∥y−v∗∥\|y - v^*\| are small relative to the response norm ∥y∥\|y\|, confining ss to a narrow neighborhood around 1.0 without enforcing ∑kαk=1\sum_k \alpha_k = 1 during optimization.

  4. Knowl 4 — Equivalent Single-Tree Representation of Stacked Nested Trees

    theoretical result

    When CART pruning produces a nested sequence of subtrees T1⊂T2⊂⋯⊂TKT_1 \subset T_2 \subset \dots \subset T_K (where TkT_k denotes the pruned subtree with kk terminal nodes), stacking these subtrees with non-negative weights αk≥0\alpha_k \ge 0 yields a predictor v(x)=∑k=1Kαkvk(x)v(x) = \sum_{k=1}^K \alpha_k v_k(x) that is mathematically equivalent to a single regression tree having the structure and terminal node partition of the largest tree TmT_m in the stack (m=max⁡{k:αk>0}m = \max \{k : \alpha_k > 0\}).

    For any terminal node tt in the largest tree TmT_m, the predicted response value y(t)y(t) in the combined tree is given by: y(t)=∑k=1mαkyˉ(tk)y(t) = \sum_{k=1}^m \alpha_k \bar{y}(t_k) where tkt_k is the unique ancestor node of tt in subtree TkT_k, and yˉ(tk)\bar{y}(t_k) is the sample mean of the target values yy belonging to node tkt_k.

    Stacking nested regression trees therefore acts as hierarchical shrinkage: the prediction in each terminal node of the fine tree gathers statistical strength by blending its local average with the broader sample means of its ancestor nodes in simpler subtrees.

  5. Knowl 5 — Test Error Reduction by Stacking CART Subtrees on Real Datasets

    data/table

    Stacking regression trees of different terminal node sizes was evaluated on the Boston Housing dataset (506 cases, 12 variables) and the Ozone dataset (330 complete cases, 8 variables). In each of 100 iterations, 50 cases were randomly held out as test data LTS\mathcal{L}_{TS}, while 10-fold cross-validation (J=10J = 10) on the remaining cases was used to compute non-negative stacking weights αk\alpha_k across approximately 50 subtrees.

    Boston Housing Ozone
    Metric Best Single Tree Stacked Trees Best Single Tree Stacked Trees
    Mean Test Prediction Error 20.9 19.0 23.9 21.6
    Average ∣∑kαk−1∣|\sum_k \alpha_k - 1| — 0.04 — 0.03
    Average # Subtrees in Stack 1 6.5 1 6.3

    Stacking achieves an approximately 10% reduction in mean squared prediction error compared to selecting the single best cross-validated tree on both datasets. The non-negative least squares solver assigns non-zero weights to only a sparse subset (averaging 6.3 to 6.5 subtrees) out of the roughly 50 available candidate subtrees, and the unconstrained sum of weights remains within 3% to 4% of 1.0.

  6. Knowl 6 — Synthetic Evaluation Framework for Linear Model Error

    experimental setup

    A standard simulation design evaluates stacked linear regressions with N=60N = 60 observations and M=40M = 40 predictor variables generated from a zero-mean multivariate normal distribution N(0,Γ)\mathcal{N}(0, \Gamma). The covariance matrix Γ\Gamma has elements: Γkm=R∣k−m∣,k,m∈{1,…,40}\Gamma_{km} = R^{|k-m|}, \quad k, m \in \{1, \ldots, 40\} with correlation parameters R∈{0.7,0,−0.7}R \in \{0.7, 0, -0.7\}.

    The response variable is generated as Y=∑m=140βmXm+ϵY = \sum_{m=1}^{40} \beta_m X_m + \epsilon, where ϵ∼N(0,1)\epsilon \sim \mathcal{N}(0, 1). The true regression coefficients βm=γαm\beta_m = \gamma \alpha_m are structured into three clusters centered at indices m∈{10,20,30}m \in \{10, 20, 30\} parameterized by an integer width h∈{1,2,3,4,5}h \in \{1, 2, 3, 4, 5\}: αm=(h−∣m−c∣)2if ∣m−c∣<h for c∈{10,20,30},and αm=0 otherwise\alpha_m = (h - |m - c|)^2 \quad \text{if } |m - c| < h \text{ for } c \in \{10, 20, 30\}, \quad \text{and } \alpha_m = 0 \text{ otherwise} Setting h=1h = 1 yields 3 strong non-zero coefficients; setting h=5h = 5 yields 27 weak non-zero coefficients. The constant γ\gamma is calibrated in each setting such that the theoretical signal-to-noise ratio satisfies: R2=E[(∑m=140βmXm)2]1+E[(∑m=140βmXm)2]=0.5R^2 = \frac{\mathbb{E}\left[\left(\sum_{m=1}^{40} \beta_m X_m\right)^2\right]}{1 + \mathbb{E}\left[\left(\sum_{m=1}^{40} \beta_m X_m\right)^2\right]} = 0.5

    Performance across 250 independent replications is evaluated by the scaled Model Error (ME): N⋅ME=N(β^−β)TΓ(β^−β)N \cdot \text{ME} = N (\hat{\beta} - \beta)^T \Gamma (\hat{\beta} - \beta)

  7. Knowl 7 — Performance of Stacked Stepwise Subset Regressions

    empirical result

    In synthetic linear regression simulations with N=60N=60 cases and M=40M=40 predictors across correlation settings R∈{0.7,0,−0.7}R \in \{0.7, 0, -0.7\} and coefficient patterns h∈{1,2,3,4,5}h \in \{1, 2, 3, 4, 5\}, stacking the 40 linear models generated by backward stepwise variable deletion via non-negative least squares uniformly outperforms selecting the single best subset model via cross-validation.

    The scaled model error N⋅MEN \cdot \text{ME} of the stacked subset regression is consistently lower across all 15 simulation configurations, with estimated standard errors ranging from 0.7 to 1.0 for stacked regression compared to 1.3 to 2.0 for the cross-validation selected best subset model.

    Stacking also uniformly outperforms three heuristic model mixtures:

    1. An equally weighted mixture of the 5 subsets with lowest cross-validation error.
    2. An equally weighted mixture of the 10 subsets with lowest cross-validation error.
    3. An adaptive mixture of all models with estimated cross-validation error within PE^min⁡+0.2(PE^full−PE^min⁡)\widehat{\text{PE}}_{\min} + 0.2(\widehat{\text{PE}}_{\text{full}} - \widehat{\text{PE}}_{\min}) (or 0.40.4 if fewer than four models qualify).

    Across all 15 simulation configurations, the average number of subset models assigned non-zero stacking weights αk>0\alpha_k > 0 is 3.1 (ranging between 2.9 and 3.4).

  8. Knowl 8 — Joint Stacking of Stepwise Subset and Ridge Regressions

    empirical result

    Stacking was evaluated on a combined ensemble containing both K=40K = 40 stepwise backward deletion subset models and K′=40K' = 40 ridge regression models corresponding to regularization parameters λk=0.1k2\lambda_k = 0.1 k^2 (k=1,…,40k = 1, \ldots, 40), forming an 80-dimensional non-negative least squares problem on cross-validation level-one data.

    This joint stack was compared against a "best of best" baseline that selects the single best subset regression by cross-validation and the single best ridge regression by cross-validation, and then selects whichever of the two has lower estimated prediction error.

    Across all combinations of predictor correlation R∈{0.7,0,−0.7}R \in \{0.7, 0, -0.7\} and coefficient structure h∈{1,2,3,4,5}h \in \{1, 2, 3, 4, 5\}, joint stacking achieves uniformly lower model error than the "best of best" selector, often by large margins. The estimated standard errors of N⋅MEN \cdot \text{ME} are 0.6 to 0.9 for joint stacking versus 0.7 to 2.1 for "best of best". The average number of non-zero model weights in the combined stack is 3.4 (ranging from 2.9 to 3.6).

  9. Knowl 9 — Predictor Diversity and the Differential Gain of Stacking Ridge versus Subset Regressions

    empirical result

    Stacking ridge regressions across different penalty parameters λ1,…,λK\lambda_1, \ldots, \lambda_K achieves substantial reductions in model error over the single best CV-selected ridge model only when predictor variables exhibit negative correlation (R=−0.7R = -0.7), with minimal to no gain at R=0R = 0 or R=0.7R = 0.7. In contrast, stacking subset regressions produces large and consistent reductions across all correlation structures.

    This difference arises because stepwise subset regression causes sharp, discrete changes in coefficient estimates when transitioning from k+1k+1 to kk variables, producing diverse candidate predictors. Ridge regression modifies coefficients smoothly and continuously as λ\lambda varies from λk\lambda_k to λk+1\lambda_{k+1}, meaning candidate models close to the optimal ridge parameter are highly collinear and provide little complementary predictive value.

    In simulations, stacked ridge retains an average of only 1.6 to 2.3 active models with non-zero weights, compared to 2.9 to 3.4 for subset stacking. Stacking delivers its greatest accuracy gains when the combined base predictors are structurally dissimilar.

  10. Knowl 10 — Comparison of 10-Fold Cross-Validation and Leave-One-Out for Level-One Data

    data/table

    Level-one training data generated by 10-fold cross-validation (J=10J=10) was compared against leave-one-out cross-validation (J=N=60J=N=60) across 250 simulation iterations for three predictor correlation settings (R∈{−0.7,0,0.7}R \in \{-0.7, 0, 0.7\}) with N=60N=60 and M=40M=40.

    Method R=−0.7R = -0.7 R=0R = 0 R=0.7R = 0.7
    Best Subset 45.6 [43.5] 43.9 [42.7] 35.3 [33.8]
    Best Ridge 43.3 [43.5] 34.5 [34.5] 17.1 [17.3]
    Best of Best 44.3 [41.3] 36.0 [32.8] 21.3 [19.2]
    Stacked Subsets 34.2 [32.7] 33.6 [31.4] 28.7 [27.9]
    Stacked Ridge-Subset 33.5 [32.3] 31.2 [29.0] 19.8 [18.0]

    Entries report average scaled Model Error (N⋅MEN \cdot \text{ME}); the unbracketed value denotes leave-one-out cross-validation and the bracketed value denotes 10-fold cross-validation. In addition to being substantially less computationally demanding, 10-fold cross-validation achieves slightly lower model error than leave-one-out cross-validation across nearly every selection and stacking strategy.

Coverage note — Brief exploratory mentions of stacking linear regressions with k-nearest neighbors and preliminary unconstrained vs constrained numerical runs in Table 4 were omitted as they are minor extensions of the main tree and linear regression stacking results.

References

  1. 1.Belsley, D.A., Kuh, E. and Welsch, R., "Regression Diagnostics," 1980, John Wiley and Sons, New York.
  2. 2.Berger, J.O. and Bock, M.E., "Combining independent normal mean estimation problems with unknown variances," Ann. Statist. 4, 1976, pp. 642-648.
  3. 3.Breiman, L., Friedman, J., Olshen, R. and Stone, J., "Classification and Regression Trees," 1984, Wadsworth, California.
  4. 4.Breiman, L. and Friedman, J.H., "Estimating Optimal Transformations in Multiple Regression and Correlation (with discussion)," J. Amer. Statist. Assoc., 80, 1985, pp. 580-619.
  5. 5.Breiman, L. and Spector, P., "Submodel Selection and Evaluation - X Random Case," International Statistical Review, 3, 1992, pp. 291-319.
  6. 6.Efron, B. and Morris, C., "Combining possibly related estimation problems (with discussion)," J. Roy. Statist. Soc. Ser. B, 35, 1973, pp. 379-421.
  7. 7.Green, E.J. and Strawderman, W.E., "A James-Stein type estimator for combining unbiased and possibly biased estimators," J. Amer. Statist. Assoc., 86, 1991, pp. 1001-1006.
  8. 8.Hoerl, A.E. and Kennard, R.W., "Ridge regression: Biased estimation for nonorthogonal problems," Technometrics, 12, 1970, pp. 55-67.
  9. 9.Lawson, J. and Hanson, R., "Solving Least Squares Problems," 1974, Prentice-Hall, New Jersey.
  10. 10.Luenberger, D., "Linear and Nonlinear Programming," 1984, Addison-Wesley Publishing Co.
  11. 11.Le Blanc, M. and Tibshirani, R., "Combining Estimates in Regression and Classification," Technical Report 9318, 1973, Dept. of Statistics, University of Toronto.
  12. 12.Perrone, M.P., "General Averaging Results for Convex Optimization," Proceedings of the 1993 Connectionist Models Summer School, Erlbaum Associates, 1994, pp. 364-371.
  13. 13.Rao, J.N.K. and Subrahmaniam, K., "Combining independent estimators and estimation in linear regression with unequal variances," Biometrics, 27, 1971, pp. 971-990.
  14. 14.Rubin, D.B. and Weisberg, S., "The variance of a linear combination of independent estimators using estimated weights," Biometrika, 62, 1975, pp. 708-709.
  15. 15.Wolpert, D., "Stacked Generalization," Neural Networks, Vol. 5, 1992, pp. 241-259.

Citation

MLA
Breiman, L. “Stacked Regressions”. Machine Learning, vol. 24, no. 1, 1996, pp. 49–64, https://doi.org/10.1007/BF00117832.
APA
Breiman, L. (1996). Stacked regressions. Machine Learning, 24(1), 49–64. https://doi.org/10.1007/BF00117832
Chicago
Breiman, L. 1996. “Stacked Regressions”. Machine Learning 24 (1): 49–64. https://doi.org/10.1007/BF00117832.
Harvard
Breiman, L. (1996) “Stacked regressions”, Machine Learning, 24(1), pp. 49–64. Available at: https://doi.org/10.1007/BF00117832.
Vancouver
1. Breiman L (1996) Stacked regressions. Machine Learning 24:49–64

BibTeX

@article{Breiman_1996, title={Stacked regressions}, volume={24}, ISSN={1573-0565}, url={http://dx.doi.org/10.1007/BF00117832}, DOI={10.1007/bf00117832}, number={1}, journal={Machine Learning}, publisher={Springer Science and Business Media LLC}, author={Breiman, Leo}, year={1996}, month=July, pages={49–64} }
Metadata:Crossref

Access the Paper

This paper is available from its original source. Click below to access the PDF.

Open PDF