Stacking
polars_ts.ensemble.stacking
Stacking forecaster using a meta-learner.
Trains a meta-learner on out-of-fold predictions from multiple base models, then combines new forecasts through the fitted meta-learner.
StackingForecaster
Stacking ensemble that trains a meta-learner on base model predictions.
Parameters
meta_learner
A scikit-learn-compatible estimator with fit and predict.
id_col
Column identifying each time series.
time_col
Column with timestamps.
target_col
Column with actual target values.
fit(cv_predictions, actuals)
Train the meta-learner on out-of-fold base model predictions.
Parameters
cv_predictions
List of DataFrames, one per base model, each containing
out-of-fold predictions with columns [id_col, time_col, "y_hat"].
actuals
DataFrame with actual values in target_col, keyed by
id_col and time_col.
Returns
StackingForecaster
Fitted forecaster (self).
predict(forecasts)
Combine base model forecasts through the fitted meta-learner.
Parameters
forecasts
List of forecast DataFrames, one per base model, each with
[id_col, time_col, "y_hat"].
Returns
pl.DataFrame
Combined forecast with columns [id_col, time_col, "y_hat"].