🧩
Stacking Ensemble
Stacking Ensemble is a machine learning technique that combines multiple models (base learners) to improve predictive performance. The predictions of base models are used as inputs to a meta-model, which learns how to best combine them.
Key Features
- Combines strengths of multiple models
- Reduces overfitting and improves generalization
- Flexible with different types of base learners
Example Use
# Python (scikit-learn)
from sklearn.ensemble import StackingRegressor
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.svm import SVR
estimators = [
('dt', DecisionTreeRegressor()),
('svr', SVR())
]
stack = StackingRegressor(
estimators=estimators,
final_estimator=LinearRegression()
)