AppStars

Essential Energy, 2020–2021

Energy demand forecasting: 30 days ahead, for every customer segment.

We built deep-learning models that forecast 30 days of daily energy demand for each customer segment on Essential Energy's network: a CNN-LSTM trained on more than four years of metering data in BigQuery, served from a Flask API in Docker, and shown in Power BI for the people who plan the network.

Client
Essential Energy, the NSW Government-owned electricity distributor
Industry
Energy & utilities
Services
Predictive AI, LSTM demand forecasting, data engineering, MLOps
Platforms
Python, TensorFlow and Keras, BigQuery, Flask in Docker behind nginx, Power BI
Our role
We led the innovation data-science work, built the models and wrote the program's data-science and machine-learning guidelines.

The challenge

Network planners wanted a number for every kind of customer, every day, a month ahead: residential, time-of-use, controlled load, commercial and industrial demand, street lighting and solar export. Each behaves differently, with its own weekly rhythm, holiday effects and seasonal peaks.

Forecasts are easy to get subtly wrong. A feature you won't have on the day, a random validation split, or one error number averaged over thirty days can all make a model look far better than it is. The challenge was as much about honest engineering as about the network architecture.

Our approach

We started with the data, not the model. Before forecasting, we profiled the asset database to learn which attributes were actually filled in, and carried those habits across: know the holes, know the outliers, and know exactly what you will have at prediction time.

Then we built one configurable codebase rather than twenty projects. Each segment is a JSON config naming the tariff codes it aggregates and its model settings, and the model, trainer, predictor, preprocessor and data source are swappable parts chosen by name. It is the structure we still use for predictive AI work.

What we built

Features from the calendar and the past

Demand is mostly a story about the calendar and recent history. The production features were public holidays, NSW school holidays, weekends, season (one-hot, with all four columns always present), week, month and year, plus lags of yesterday, the same day last week and the same day last year, and weekly and monthly rolling means. The 365-day lag hands the model Christmas and summer peaks directly.

The series was made strictly daily, with gaps forward-filled and outliers beyond set thresholds interpolated from their neighbours. Import and export are measured together, so each is dropped when forecasting the other: you won't have either on the morning you need the forecast.

A CNN-LSTM with a direct 30-day output

A 1D convolution with 64 filters over a 7-day kernel learns weekly shapes, such as the weekday-weekend cycle, and hands a stack of LSTM layers (1,200, 900, 600, 300 and 60 units, with recurrent dropout) a cleaner signal. A dense layer then predicts all thirty days at once. A recursive model would predict tomorrow and feed it back in, compounding its errors; a direct model has no such loop. Training used Adam on mean absolute error, which is in MWh per day and easy to explain to the people using it.

In notebooks we also compared a single LSTM, a pure CNN and a weighted blend, and explored weather features, before settling on this shape for production.

Validation that doesn't flatter

The most recent 90 days were held out, never a random split. Scalers were fitted on training data only. The preprocessor refuses to run if the validation period is shorter than the input window plus twice the forecast horizon. Error was scored for each of the thirty horizons separately, with R² and MAE and a chart with an error band for every step, because day one is not day thirty.

Training discipline and reproducible builds

Checkpoints on the best validation loss, a learning rate that backs off on plateaus, and early stopping kept long training budgets from overfitting. Each build saved its model, best checkpoint, scalers and validation error together, with fixed random seeds, so any forecast can be traced to the exact artefacts that made it.

Serving and write-back

A Flask API in Docker behind nginx answers a request for a segment and start date. Prediction builds thirty days of future calendar features, forecasts, reverses the scaling, and writes the result to a BigQuery forecast table that feeds Power BI.

Architecture

  1. BigQueryDaily MWh by segment and calendar flags
  2. PreprocessHolidays, seasons, lags, rolling means, scaling
  3. CNN-LSTM30 days in, 30 days out, per segment
  4. Build artefactsModel, scalers and validation error together
  5. ServeFlask API, BigQuery forecast table, Power BI

Twenty segment configs, one codebase.

Results

Under the hood

Deep learning, served as an API to the people who plan the network.

Line chart of a 30-day commercial energy forecast in megawatt hours, with a shaded confidence band and a clear weekday and weekend cycle
A 30-day commercial forecast with its error band. The weekday and weekend cycle is clear.

What it taught us

The network architecture was the smaller part of the work. Data profiling, feature design, leak prevention and honest validation took most of the effort and made most of the difference. We also wrote the program's guidelines for the model lifecycle, versioning, monitoring and CI/CD for machine learning, because agile delivery alone fits data science poorly: an experiment can succeed or fail on the data before anyone writes a feature. The data came from the same warehouse as Network Visibility.

What we would do now

  • Beat a baseline first. Score "the same day last year, adjusted for recent growth" the same way as the model. A deep model has to beat the obvious answer by enough to justify itself.
  • Forecast ranges, not points. Quantile or probabilistic outputs tell planners how much to trust each day.
  • Try simpler models seriously. Gradient-boosted trees on the same features are often as good, faster to train and easier to explain.
  • Monitor drift in production. Rooftop solar and batteries change load shapes every year; a model needs alerts when its error creeps up.
  • Keep it on your own infrastructure. Metering data is sensitive. Training and serving belong on systems the organisation controls, which is the heart of our self-hosted AI approach.

Questions

What is LSTM demand forecasting?

A long short-term memory network is a deep-learning model that learns patterns in sequences. Here, a convolution plus stacked LSTM layers learned daily energy demand and predicted the next 30 days for each customer segment.

Why forecast each customer segment separately?

Residential, commercial, industrial, street lighting and solar export behave differently. A model per tariff segment, from one shared codebase, captures each one's rhythm.

How do you stop a forecast looking better than it is?

Hold out the most recent period, fit scalers on training data only, remove features you won't have on the day, and score every forecast day separately.

Would you build it differently today?

We would add a simple baseline to beat, forecast ranges as well as points, and monitor drift in production, all on infrastructure the organisation controls.

Related

The services behind this work, and more stories like it.

Services

Case studies

Bring us the hard problem.

A 45-minute discovery call with the engineer who'll build it.