Stacking is an ensemble learning technique that combines multiple models to improve predictive performance. In contrast to other ensemble methods, stacking performs the predictions of the models after each other.
Stacking is used in scenarios where leveraging the strengths of different models can lead to better accuracy and robustness, such as in classification and regression tasks. It is particularly useful when individual models have complementary strengths and weaknesses.
Stacking works by training a set of first-level models on the same dataset and then using their outputs as inputs for a second-level model, which makes the final prediction. The first-level models can be of the same type with different hyperparameters or completely different models. The second-level model, often a simple linear or logistic regression, learns to combine the outputs of the first-level models to produce a more accurate prediction.
For example, in a classification task, the first-level models might include a decision tree, a neural network, and a support vector machine. Their outputs are then fed into a logistic regression model, which makes the final prediction based on the combined information.
Research has suggested that linear regression for value prediction or logistic regression for classification are the best choices for the second-level model.
Note that most Neural Networks can be regarded as an extrapolation of the stacking paradigm where each neuron is equivalent to a model and the number of layers is increased from two.
- Alias
- Stacked Generalization
- Related terms
- Bagging Boosting Voting Ensemble