Time series · May 2025

Energy Demand Forecasting

A time-series model that predicts hourly electricity demand for American Electric Power, trained on more than a decade of history.

Fourteen years of hours

The model trained on hourly demand from 2004 through 2018, about 121,000 observations. That much history holds every rhythm the grid runs on: the daily peak and trough, the weekly work cycle, the long seasonal swing between summer cooling and winter heating.

Teaching time to a tree

XGBoost has no built-in sense of time, so I gave it one through features: hour of day, day of week, month, and lag variables that let it look back at recent demand. Those temporal features are what let the model pick up the seasonal patterns and demand cycles, and they carried it to an RMSE of 1,644 megawatts on typical days.

RMSE of 1,644 MW across 14 years of hourly demand.Solid on the ordinary days, blind to the storms.

Where it broke, and why that's fair

It held up well on ordinary demand and missed the extreme weather events, which is exactly what you would expect: XGBoost does not know a heat wave is coming unless you hand it weather features, and I did not. It is a clean reminder that a model does not "learn" the world. It learns whatever is in the input columns, and nothing else.

Pythonpandasscikit-learnXGBoostMatplotlib