E2E Time Series Forecasting & Analytics System

Data Scientist / ML Engineer

2026 (Ongoing)

◎ Demo Soon

Quick Links

On this page

Production-grade time series forecasting platform with leakage-safe ETL pipelines, recursive multi-step prediction, rolling-origin backtesting, and FastAPI serving — deployed on GCP Cloud Run.

Problem

Retail sales forecasting requires handling messy real-world data, preventing data leakage across a complex feature pipeline, and serving predictions reliably via a production API with full model governance and auditability.

Solution

Built an end-to-end forecasting system on the Rossmann store sales dataset (1,115 stores, 811,615 training rows). ETL pipeline (ingest → clean → augment → validate) outputs to Parquet. Feature engineering generates 22 leakage-safe features — lags [1,7,14], rolling stats [7,14], calendar features — with target_raw permanently blocked via frozenset guard. LightGBM primary model with Seasonal Naive baseline; recursive multi-step forecasting for horizons up to 60 days, re-running the feature pipeline at each step. FastAPI backend with Pydantic v2 validation, 95% confidence intervals from residual std, rolling-origin backtesting, and versioned model metadata governance. LLM copilot explains precomputed results in natural language — never generates predictions. CI/CD via GitHub Actions (lint, test, train & artifact validation, API smoke, Docker build). GCP deployment via Terraform (Cloud Run, GCS, Secret Manager).

Key Technical Decisions

  • Recursive forecasting re-runs the full feature pipeline at each step — prevents the common bug where all horizon steps return identical predictions due to stale lag values.
  • target_raw permanently blocked via frozenset(_NEVER_FEATURE_COLS) — identified as a severe leakage source with gain orders of magnitude higher than any legitimate feature.
  • feature_columns.json persisted at training time and strictly enforced at inference — guarantees train/serve feature parity across model versions.
  • LLM copilot is explanation-only (never predicts) — keeps forecasts deterministic and auditable while still providing natural-language summaries for non-technical users.
  • Rolling-origin backtesting uses the fixed production model (no retraining per split) to measure real-world generalization across different time periods.

Key Results

  • 811,615 training rows across 1,115 stores; 22 engineered leakage-safe features
  • Recursive multi-step forecasting for horizons 1–60 days
  • Rolling-origin backtesting: per-split RMSE / MAE / MAPE with averages
  • 95% confidence intervals computed from training residual std
  • Leakage prevention: target_raw permanently blocked; feature columns persisted and enforced at inference
  • Model governance: versioned metadata (version, trained_at, feature_count, metrics) on every run
  • CI/CD: lint → test → train+validate → API smoke → Docker build on every push
  • GCP Cloud Run deployment with Terraform infrastructure-as-code

Tech Stack

PythonLightGBMPandasFastAPIPydantic v2StreamlitPlotlyDockerGitHub ActionsGCP Cloud RunTerraformOpenAI APIReact / TypeScriptJoblib