- Introduced by
- Wolpert, D. H. (stacking); XAI integration developed across the community
- Year
- 1992 (stacking); 2010s–2020s (explainable extensions)
- Type
- Ensemble meta-learning with post-hoc or intrinsic interpretability
- Family
- Machine learning
What does it do?
Explainable Stacking Ensemble combines stacked generalisation, which trains a meta-learner on the outputs of several diverse base models, with post-hoc attribution tools such as SHAP that show how each base model and, approximately, each input feature contributed to a prediction.
It aims to keep the predictive gains of stacking while making individual predictions inspectable, which matters where a model's output must be justified.
The intuition behind the method
Stacking already draws on several different models by letting a meta-learner learn which base predictions to trust and when. The drawback is that this layered structure makes it harder to see what drives an output. Explainable stacking adds a transparency layer on top of the same pipeline: SHAP values are computed for the meta-learner, which attributes each prediction to the base-model outputs it received. Those attributions can then be passed to each base model's own explanation to reach raw features, though this second step is an approximation. The practitioner keeps the ensemble's predictions and gains a way to audit each component's role.
History
Stacked generalisation was introduced by David Wolpert in 1992 as a way of combining learners through a meta-learner trained on their outputs. The attribution methods used for explanation in this pipeline, in particular SHAP, are associated here with Lundberg and Lee (2017), 'A unified approach to interpreting model predictions'. Explainable stacking as a combined approach is a later development in applied machine learning, and no single originating paper is cited for it.
When to use it
Choose Explainable Stacking Ensemble when you need strong predictive performance on tabular data and must also justify individual predictions to stakeholders, regulators or reviewers, for example in clinical risk scoring, credit assessment or other policy-relevant prediction. It is suited to problems where several candidate models of different types are plausible and the dataset is large enough for cross-validated out-of-fold predictions to be stable. Do not use it when a single interpretable model such as logistic regression or a decision tree performs adequately, when the computational budget is tight, or when a single closed-form equation is required. It is also a poor choice when the sample is too small for the cross-validation folds to produce stable meta-features.
Limitations and considerations
- Implementing, validating and communicating an ensemble of several base learners and a meta-learner is considerably more involved than fitting a single model.
- Exact SHAP values are available for some model classes, such as tree-based models (TreeSHAP) and linear models. For others, such as support vector machines and neural networks, they are estimated by sampling-based methods (for example KernelSHAP), so those explanations inherit estimation error. Check estimator convergence or variance before interpreting small attribution differences.
- Training cost grows with the number of base learners and the number of cross-validation folds.
- Tracing explanations from the meta-learner back to raw input features is an approximation, not an exact derivation through the whole pipeline.
- Reproducibility requires recording the versions of every base learner, its OOF predictions and the meta-learner.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Combines the predictions of diverse base models, and attribution tools make each base model's contribution inspectable.
- Any set of base learners can be assembled, so domain knowledge can guide which model types are included.
- Because the meta-learner takes the base-model outputs as its inputs, its SHAP attributions indicate how much each base model's output moved a given prediction. The ranking of base models should be checked for stability, since base-model outputs are often correlated.
- The out-of-fold protocol keeps meta-features free of each row's own training target, which reduces leakage in the meta-learner's training data.
- Base learners from different model families can be combined on mixed tabular inputs. The meta-learner still needs enough out-of-fold data to be stable and inherits the assumptions of its own model family.
Applications
- Clinical outcome prediction where both accuracy and a justification for each prediction are required.
- Credit scoring and financial risk modelling under requirements for model explanation.
- Competitive prediction tasks, where stacking of diverse models has been used.
- Biomarker or multi-omics prediction, where base models may capture different data types.
- Prediction pipelines in environmental or social science that must be open to peer review.
How it works
How it works
Several diverse base learners, for example a decision tree, a support vector machine and a neural network, are each trained on the training set. Diversity is deliberate: models with different inductive biases tend to make errors that are less correlated, which gives the meta-learner something to combine.
To avoid leakage, predictions on the training data are generated by k-fold cross-validation: each fold is predicted by a model trained on the remaining folds. These out-of-fold (OOF) predictions become the training features for the meta-learner, so no training row is scored by a model that saw its own target.
The meta-learner, often logistic regression or a shallow tree, is trained on the OOF predictions of the base models to learn how their outputs should be combined. At prediction time, the base models trained on the full training set supply their outputs, and the meta-learner returns the final prediction.
Formula
\hat{y} = f_{\text{meta}}(\hat{y}_1, \hat{y}_2, \ldots, \hat{y}_K)Post-hoc attribution tools, most commonly SHAP, are applied to the meta-learner to attribute each prediction to its inputs, namely the base-model outputs. SHAP values are additive for a given model, so the meta-learner's attributions can be summed per base model. Tracing these contributions further to raw input features requires each base learner's own explanation and is only an approximation of the full pipeline.
Explanations are reported at several levels: which base model contributed most to a given prediction, which raw features drove that base model's output where this tracing is available, and how the ensemble's reliance on each base model varies across the dataset. Each level has a different degree of exactness. To read the values, note that a SHAP attribution is expressed in the units of the model output (for example log-odds for a logistic meta-learner, or the target scale for a regression meta-learner) and is measured relative to a baseline, which is the average model output over the background dataset. Positive values push the prediction above that baseline and negative values push it below. Attributions describe how the fitted model uses its inputs; they are not estimates of causal effects. Because the background dataset defines the baseline and affects the attributions, it should be stated alongside any reported explanation. Global importance summaries should be read together with per-prediction explanations, so that changes in influence across subgroups are not hidden.
Common pitfalls
- Generating meta-features from base models trained on the full training set. This leaks labels into the meta-learner and inflates apparent performance.
- Using highly correlated base learners, such as several variants of one algorithm, which removes much of the benefit of stacking.
- Reporting only global SHAP importance without per-prediction explanations, which can hide changes in base-model influence across subgroups.
- Treating the SHAP decomposition of the meta-learner as an exact account of the full pipeline rather than an approximation.
- Estimating performance without cross-validating the whole pipeline, including base and meta levels, which tends to give optimistic accuracy.
Frequently asked questions
How is explainable stacking different from a plain stacking ensemble?
A plain stacking ensemble is built to maximise predictive accuracy. Explainable stacking keeps the same pipeline and adds an attribution layer, usually SHAP values computed for the meta-learner, so that each prediction can be decomposed into contributions from the base models and, approximately, from the input features.
Which meta-learner is best for interpretability?
Logistic regression for classification or linear regression for regression are the most transparent choices, because their coefficients indicate the weight given to each base model's output. These weights depend on the scale of the inputs and on correlation among base-model outputs, so they should be read together with SHAP attributions and checked for stability, not taken as a direct ranking of base-model importance. Shallow decision trees are also used. More complex meta-learners such as gradient boosting may predict better, but they need additional attribution analysis before their behaviour can be explained, and explaining a boosted meta-learner adds estimation error on top of the base-model approximations.
Does adding SHAP explanations change the predictions?
No. SHAP is a post-hoc attribution method. It analyses the trained models without changing them, so predictions are the same whether or not attribution values are computed afterwards.
How many base learners are typically used?
A small number of base learners with clearly different inductive biases is usually enough. Adding more learners can help a little, but it raises training cost and makes the explanations harder to communicate. Diversity of model type matters more than the count.
Is explainable stacking suitable for small samples?
Not usually. With few observations, the cross-validation folds used to generate out-of-fold meta-features become small, base-learner estimates vary more, and SHAP estimates become less stable. For small samples a single interpretable model is generally the better choice.
Related methods
Sources
Wolpert, D. H. (1992). Stacked generalization. Neural Networks, 5(2), 241–259.
Open DOI referenceLundberg, S. M., & Lee, S.-I. (2017). A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems, 30.
Open publication reference