Combine predictors using stacking
Stacking is an ensemble method. In this strategy, the
out-of-fold predictions from several base estimators are used to train a
meta-model that combines their outputs at inference time. Unlike
VotingRegressor, which averages predictions with
fixed (optionally user-specified) weights,
StackingRegressor learns the combination through its
final_estimator.
In this example, we illustrate the use case in which different regressors are stacked together and a final regularized linear regressor is used to output the prediction. We compare the performance of each individual regressor with the stacking strategy. Here, stacking slightly improves the overall performance.


