Greykite Forecasting
Use this skill after forecasting-data-prep. Greykite is best for interpretable univariate business forecasts with trend, seasonality, holidays/events, changepoints, autoregression, external regressors, prediction intervals, time-series CV, backtests, benchmarking, and component plots.
Do not treat Greykite as a joint multivariate or generic panel forecasting library. Its main Forecaster workflow forecasts one value_col at a time; loop over series IDs externally and use reconciliation only as documented post-processing.
Minimum Install
pip install greykite
The GitHub release page shows 1.0.0 as latest release on January 18, 2024, while current master setup metadata declares 1.1.0. Pin and verify the installed version in production. Current setup metadata requires Python >=3.10 and pins key dependencies such as pandas <2.0.0 and scikit-learn 1.3.1.
Data Contract
- Start from a
forecasting-data-prep contract: sorted timestamp, one target column, frequency, horizon, temporal cutoffs, known-future regressors, events, anomaly decisions, and leakage notes.
- Use a pandas
DataFrame. Main columns are time_col and value_col, configured through MetadataParam(time_col=..., value_col=..., freq=...).
- Provide
freq explicitly when timestamps have missing timepoints; otherwise Greykite may infer it.
- Include future rows for the forecast horizon when using regressors; future regressor values must be known for prediction.
- Use
train_end_date or EvaluationPeriodParam to enforce temporal holdouts, gaps, and CV windows.
- Use
anomaly_info only for known anomalies; do not infer adjustments from validation/test target values.
Read references/greykite-data-validation.md before using regressors, autoregression, uncertainty intervals, cross-validation, benchmarking, or multiple series.
Model Selection
Greykite supports these documented forecasting model families:
Silverkite: flagship fast/interpretable model via SILVERKITE, AUTO, and many SILVERKITE_* templates.
Prophet: PROPHET template via ProphetEstimator.
Auto-ARIMA: AUTO_ARIMA template via AutoArimaEstimator.
- Lag-based:
LAG_BASED template for simple lag/aggregated-lag baselines.
- Multistage:
SILVERKITE_TWO_STAGE, SILVERKITE_WOW, and MULTISTAGE_EMPTY.
- Low-level Silverkite:
SK template, SimpleSilverkiteForecast, and SilverkiteForecast for advanced users.
- Reconciliation:
ReconcileAdditiveForecasts reconciles multiple forecasts post hoc; it is not a base forecasting model.
Start with AUTO unless the task requires a specific template. Read references/greykite-model-map.md before claiming model/template support.
Forecasting Pattern
from greykite.framework.templates.autogen.forecast_config import ForecastConfig, MetadataParam
from greykite.framework.templates.forecaster import Forecaster
from greykite.framework.templates.model_templates import ModelTemplateEnum
config = ForecastConfig(
model_template=ModelTemplateEnum.AUTO.name,
forecast_horizon=24,
coverage=0.95,
metadata_param=MetadataParam(time_col="ts", value_col="y", freq="H"),
)
result = Forecaster().run_forecast_config(df=train_and_future_df, config=config)
forecast_df = result.forecast.df
backtest_df = result.backtest.df
For regressors, include columns in df and configure:
from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam
model_components = ModelComponentsParam(
regressors={"regressor_cols": ["promo", "planned_price"]},
)
For low-level SK, use custom={"extra_pred_cols": [...]} instead of regressors.regressor_cols.
Validation, Metrics, and Plotting
- Use
EvaluationPeriodParam for temporal backtest and rolling CV: test_horizon, periods_between_train_test, cv_horizon, cv_min_train_periods, cv_periods_between_splits, cv_periods_between_train_test, and cv_max_splits.
- Use
result.grid_search and summarize_grid_search_results(...) for CV results. Ignore raw sklearn rank columns for metrics where lower is better; use the Greykite summary helper.
- Use
result.backtest for holdout test metrics and plots. Use result.forecast for the final fitted forecast.
- Built-in evaluation uses
EvaluationMetricEnum; common choices include MAPE, RMSE, MAE-like metrics, correlation, quantile loss, coverage, and interval metrics depending on configuration.
- Plot with
result.backtest.plot(), result.forecast.plot(), plot_components(), and plot_grouping_evaluation(...).
- For residual diagnostics, use
backtest.df or CV outputs; component plots can visualize residuals and changepoints. Do not tune on final test residuals.
Intervals and Quantiles
Set ForecastConfig.coverage to request prediction bands. Silverkite and Prophet support prediction intervals. Silverkite uncertainty uses residual-based methods such as simple_conditional_residuals; Prophet uses its own uncertainty configuration. Silverkite also supports quantile loss as a fitting objective.
Validate empirical coverage and interval width on temporal backtests before relying on intervals.
Anti-Leakage Rules
- Never random split time-series rows. Use Greykite's rolling CV/backtest parameters or explicit time cutoffs.
- Fit anomaly adjustments, preprocessing, regressors, autoregression choices, changepoints, grid search, and model selection on train/CV folds only.
- Use
periods_between_train_test or cv_periods_between_train_test when a gap is needed between training and prediction.
- Use future regressors only if they are known for every forecast timestamp. Lagged regressors must be built from past values only.
- Keep
forecast_horizon, freq, train_end_date, test_horizon, CV horizons, and gaps aligned with the data-prep contract.
- For multiple IDs, loop by series and create splits/features independently per ID; do not let aggregate future target information leak into per-series features.
Common Errors
- Passing wide/panel data to
Forecaster as if it supported series_id.
- Omitting
freq when timestamps have missing timepoints.
- Including future regressor columns without known future values.
- Using
SK low-level template but configuring regressors with the high-level Silverkite syntax.
- Using autoregressive lags smaller than
forecast_horizon without understanding simulation and interval implications.
- Treating
forecast.train_evaluation as honest validation; use backtest or CV.
- Trusting raw sklearn
rank_test_* columns instead of summarize_grid_search_results.
References
- Read
references/greykite-model-map.md for templates, estimators, and capability caveats.
- Read
references/greykite-data-validation.md for data format, regressors, CV/backtesting, intervals, plotting, diagnostics, and multiple series.
- Read
references/official-sources.md for official sources consulted.
Ready Checklist
forecasting-data-prep contract is complete and leakage risks are resolved or documented.
- Data is one-target pandas format with explicit
time_col, value_col, and freq.
- Future regressor/event rows are available and known at prediction time.
- Template choice supports required regressors, autoregression, intervals, and horizon.
- Validation uses temporal holdout/CV with any required gap, not random split.
- Metrics, plots, residuals, and interval coverage are computed on held-out periods only.
1---2name: greykite-forecasting3description: Use LinkedIn Greykite for interpretable univariate forecasting after forecasting-data-prep, including pandas DataFrame inputs with time/value/regressor columns, Forecaster.run_forecast_config, ForecastConfig, MetadataParam, Silverkite, Prophet, Auto-ARIMA, lag-based and multistage templates, AUTO/SILVERKITE model templates, holidays/events, changepoints, regressors, lagged regressors, autoregression, prediction intervals via coverage, rolling time-series CV/backtest, benchmarking, plotting, component diagnostics, and anti-leakage safeguards.4---56# Greykite Forecasting78Use this skill after `forecasting-data-prep`. Greykite is best for interpretable univariate business forecasts with trend, seasonality, holidays/events, changepoints, autoregression, external regressors, prediction intervals, time-series CV, backtests, benchmarking, and component plots.910Do not treat Greykite as a joint multivariate or generic panel forecasting library. Its main `Forecaster` workflow forecasts one `value_col` at a time; loop over series IDs externally and use reconciliation only as documented post-processing.1112## Minimum Install1314```bash15pip install greykite16```1718The GitHub release page shows 1.0.0 as latest release on January 18, 2024, while current `master` setup metadata declares 1.1.0. Pin and verify the installed version in production. Current setup metadata requires Python `>=3.10` and pins key dependencies such as pandas `<2.0.0` and scikit-learn `1.3.1`.1920## Data Contract2122- Start from a `forecasting-data-prep` contract: sorted timestamp, one target column, frequency, horizon, temporal cutoffs, known-future regressors, events, anomaly decisions, and leakage notes.23- Use a pandas `DataFrame`. Main columns are `time_col` and `value_col`, configured through `MetadataParam(time_col=..., value_col=..., freq=...)`.24- Provide `freq` explicitly when timestamps have missing timepoints; otherwise Greykite may infer it.25- Include future rows for the forecast horizon when using regressors; future regressor values must be known for prediction.26- Use `train_end_date` or `EvaluationPeriodParam` to enforce temporal holdouts, gaps, and CV windows.27- Use `anomaly_info` only for known anomalies; do not infer adjustments from validation/test target values.2829Read `references/greykite-data-validation.md` before using regressors, autoregression, uncertainty intervals, cross-validation, benchmarking, or multiple series.3031## Model Selection3233Greykite supports these documented forecasting model families:3435- `Silverkite`: flagship fast/interpretable model via `SILVERKITE`, `AUTO`, and many `SILVERKITE_*` templates.36- `Prophet`: `PROPHET` template via `ProphetEstimator`.37- `Auto-ARIMA`: `AUTO_ARIMA` template via `AutoArimaEstimator`.38- Lag-based: `LAG_BASED` template for simple lag/aggregated-lag baselines.39- Multistage: `SILVERKITE_TWO_STAGE`, `SILVERKITE_WOW`, and `MULTISTAGE_EMPTY`.40- Low-level Silverkite: `SK` template, `SimpleSilverkiteForecast`, and `SilverkiteForecast` for advanced users.41- Reconciliation: `ReconcileAdditiveForecasts` reconciles multiple forecasts post hoc; it is not a base forecasting model.4243Start with `AUTO` unless the task requires a specific template. Read `references/greykite-model-map.md` before claiming model/template support.4445## Forecasting Pattern4647```python48from greykite.framework.templates.autogen.forecast_config import ForecastConfig, MetadataParam49from greykite.framework.templates.forecaster import Forecaster50from greykite.framework.templates.model_templates import ModelTemplateEnum5152config = ForecastConfig(53 model_template=ModelTemplateEnum.AUTO.name,54 forecast_horizon=24,55 coverage=0.95,56 metadata_param=MetadataParam(time_col="ts", value_col="y", freq="H"),57)5859result = Forecaster().run_forecast_config(df=train_and_future_df, config=config)60forecast_df = result.forecast.df61backtest_df = result.backtest.df62```6364For regressors, include columns in `df` and configure:6566```python67from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam6869model_components = ModelComponentsParam(70 regressors={"regressor_cols": ["promo", "planned_price"]},71)72```7374For low-level `SK`, use `custom={"extra_pred_cols": [...]}` instead of `regressors.regressor_cols`.7576## Validation, Metrics, and Plotting7778- Use `EvaluationPeriodParam` for temporal backtest and rolling CV: `test_horizon`, `periods_between_train_test`, `cv_horizon`, `cv_min_train_periods`, `cv_periods_between_splits`, `cv_periods_between_train_test`, and `cv_max_splits`.79- Use `result.grid_search` and `summarize_grid_search_results(...)` for CV results. Ignore raw sklearn rank columns for metrics where lower is better; use the Greykite summary helper.80- Use `result.backtest` for holdout test metrics and plots. Use `result.forecast` for the final fitted forecast.81- Built-in evaluation uses `EvaluationMetricEnum`; common choices include MAPE, RMSE, MAE-like metrics, correlation, quantile loss, coverage, and interval metrics depending on configuration.82- Plot with `result.backtest.plot()`, `result.forecast.plot()`, `plot_components()`, and `plot_grouping_evaluation(...)`.83- For residual diagnostics, use `backtest.df` or CV outputs; component plots can visualize residuals and changepoints. Do not tune on final test residuals.8485## Intervals and Quantiles8687Set `ForecastConfig.coverage` to request prediction bands. Silverkite and Prophet support prediction intervals. Silverkite uncertainty uses residual-based methods such as `simple_conditional_residuals`; Prophet uses its own uncertainty configuration. Silverkite also supports quantile loss as a fitting objective.8889Validate empirical coverage and interval width on temporal backtests before relying on intervals.9091## Anti-Leakage Rules9293- Never random split time-series rows. Use Greykite's rolling CV/backtest parameters or explicit time cutoffs.94- Fit anomaly adjustments, preprocessing, regressors, autoregression choices, changepoints, grid search, and model selection on train/CV folds only.95- Use `periods_between_train_test` or `cv_periods_between_train_test` when a gap is needed between training and prediction.96- Use future regressors only if they are known for every forecast timestamp. Lagged regressors must be built from past values only.97- Keep `forecast_horizon`, `freq`, `train_end_date`, `test_horizon`, CV horizons, and gaps aligned with the data-prep contract.98- For multiple IDs, loop by series and create splits/features independently per ID; do not let aggregate future target information leak into per-series features.99100## Common Errors101102- Passing wide/panel data to `Forecaster` as if it supported `series_id`.103- Omitting `freq` when timestamps have missing timepoints.104- Including future regressor columns without known future values.105- Using `SK` low-level template but configuring regressors with the high-level Silverkite syntax.106- Using autoregressive lags smaller than `forecast_horizon` without understanding simulation and interval implications.107- Treating `forecast.train_evaluation` as honest validation; use `backtest` or CV.108- Trusting raw sklearn `rank_test_*` columns instead of `summarize_grid_search_results`.109110## References111112- Read `references/greykite-model-map.md` for templates, estimators, and capability caveats.113- Read `references/greykite-data-validation.md` for data format, regressors, CV/backtesting, intervals, plotting, diagnostics, and multiple series.114- Read `references/official-sources.md` for official sources consulted.115116## Ready Checklist117118- `forecasting-data-prep` contract is complete and leakage risks are resolved or documented.119- Data is one-target pandas format with explicit `time_col`, `value_col`, and `freq`.120- Future regressor/event rows are available and known at prediction time.121- Template choice supports required regressors, autoregression, intervals, and horizon.122- Validation uses temporal holdout/CV with any required gap, not random split.123- Metrics, plots, residuals, and interval coverage are computed on held-out periods only.