Module 7 · Days 61–70 · Part III

Forecasting with XGBoost & Chronos

Predictive modeling on macroeconomic time-series data.

Start Day 61
0/10 days completed
0/10 videos published

What you'll learn

  1. 1
    Days 61–63
    Supervised learning theory, tree-based models, and univariate forecasting.

    By the end: Students can frame macro forecasting as a supervised-learning problem without leaking the future. They build a **rolling-origin evaluation harness** (pseudo out-of-sample), understand decision trees, random forests and gradient boosting (XGBoost) from the ground up, and run an honest **univariate horse race** for Canadian CPI inflation at several horizons. Every model is judged against naive and autoregressive benchmarks, with statistical tests and calibrated prediction intervals.

  2. 2
    Days 64–67
    Hyperparameter tuning, SHAP explainability, and zero-shot forecasting with Chronos.

    By the end: Students can tune XGBoost **without contaminating the test period**, explain every forecast with **SHAP values** (globally, for a single forecast, and as a decomposition over time), and evaluate a pretrained **time-series foundation model (Chronos)** zero-shot in the same harness. They finish with probabilistic scores and a combination forecast, and choose, with evidence, which models to carry into the Day 68–70 CPI and GDP forecasting system.

  3. 3
    Days 68–70
    Forecasting Canadian CPI and real GDP growth with features engineered earlier.

    By the end: - **Day 68.** Students forecast **CPI inflation** with **multivariate features** drawn from the marts built in Modules 2–4 (rates, spreads, FX, oil, labour market, core and breadth measures), respecting each indicator's **publication lag**. **Day 69.** They **nowcast and forecast real GDP growth** from monthly indicators with a "ragged edge" and handle the COVID outliers honestly. **Day 70.** They put the forecasting system **into production** inside the Prefect pipeline: published forecasts with metadata, dbt marts that track **live accuracy**, GX checks on forecasts, monitoring for out-of-range inputs, a model card, and a forecast dashboard.

Tools

XGBoostscikit-learnSHAPChronos

The ten days

Before you start: module setup and project structure

Audience: MSc Economics students who completed Parts I–II (Days 1–60) Environment: GitHub Codespaces · a new .venv-ml · the dbt marts exported to data/marts/*.parquet Time per day: ~2.5 hours (including breaks and exercises) Goal by end of Day 63: Students can frame macro forecasting as a supervised-learning problem without leaking the future. They build a rolling-origin evaluation harness (pseudo out-of-sample), understand decision trees, random forests and gradient boosting (XGBoost) from the ground up, and run an honest univariate horse race for Canadian CPI inflation at several horizons. Every model is judged against naive and autoregressive benchmarks, with statistical tests and calibrated prediction intervals.


Part III begins: why the platform matters for modelling

Parts I–II built a pipeline that produces clean, tested, documented, timely data. Forecasting is where that investment pays off, because forecasting is unforgiving of data problems:

Data problemWhat it does to a forecast
a gap in the series (Day 49)lags point to the wrong month; features silently shift
a unit error (Day 41)the model learns from nonsense; error metrics explode
using revised data as if it were known at the time (Day 27)evaluation looks better than real-world performance
features computed with future informationleakage: brilliant backtests, useless forecasts

You'll meet that last problem constantly this module. Avoiding it is the single most important skill in applied forecasting.

The plan for Module 7

DaysFocus
61–63supervised learning theory, honest evaluation, trees and boosting, univariate forecasts
64–67hyperparameter tuning, SHAP explainability, zero-shot forecasting with Chronos
68–70forecasting Canadian CPI and real GDP growth with the features engineered in Modules 2–4

Target structure (by end of Day 63)

macro-data-course/
├── .venv-ml/                       ← NEW: modelling environment
├── macro_dbt/models/marts/ml/
│   └── ml_cpi_monthly.sql          ← NEW: a mart for modelling (exported to Parquet)
├── forecasting/                    ← NEW: reusable modelling code
│   ├── __init__.py
│   ├── data.py                     ← loading marts
│   ├── features.py                 ← leakage-safe feature construction
│   ├── evaluate.py                 ← rolling-origin harness, metrics, Diebold–Mariano
│   └── models.py                   ← benchmarks and model factories
├── notebooks/                      ← exploration (day61.ipynb, …)
└── data/forecasts/                 ← results (not committed)