Cover of Time Series Forecasting, edition 2026.11.11, code 1RPH-3A4D Time Series Forecasting 1RPH-3A4D 11 editions since Nov 2026 Rolling Edition 2026.11.11

Time Series Forecasting

Edition 2026.11.11 Examples passed Nov 20, 2026 41 of 41 examples pass What changed

Written with AI. Verified by people. How we make books

This book is open to contributions, so anyone can check it or correct it. Its repository · Report an error · How to fix one

How to forecast demand a day ahead and check that the forecast holds up: baselines, backtests that never see the future, statistical models, one LightGBM model for all clients, totals that add up, and calibrated prediction intervals, on hourly electricity demand from thirty clients.

Who it's for For data scientists and analysts who know pandas and basic regression and are asked to forecast demand, such as sales, energy, tickets or traffic, and need forecasts that hold up when they are checked.

Start reading

Labs

Work through this book in the Lab

Run every example exactly as the book did, change the code to see what happens, and try your own ideas on the book's code and data. Nothing to install, and your work is saved. Opens in about 30 seconds.

Run every example exactly as the book did, change the code to see what happens, and try your own ideas on the book's code and data. Nothing to install, and your work is saved. Labs runs it for you: 40 hours a month.

Checking for your Lab…

Edition history11 editions since November 2026Every edition and what it changed
2026.11.12026.11.11
2026.11.11 · Nov 21, 2026Prose fix, New content35 sections changed

Contents

10 chapters, about 3 hours 36 minutes to read, with 41 examples.

  1. 1Forecast tomorrow's demand

    This chapter builds the first forecast of tomorrow's demand, and the simple baseline that every later forecast has to beat.

  2. 2Set the baselines a model must beat

    In this chapter you compute three baselines for a client's day-ahead forecast, naive, seasonal naive and average of weeks, and scale a client's error with MASE, using a scale that reads only the readings before the forecast week.

  3. 3Backtest without looking ahead

    This chapter teaches you to score a day-ahead forecast over a year of cutoffs without letting the future into its history, to handle the two clock-change hours in the data, and to run a shift test that catches a feature which reads past its cutoff.

  4. 4Fit a statistical model for each client

    Here you fit AutoETS and a fixed seasonal ARIMA for each client over the same backtest, score both against seasonal naive, and learn to start a late-starting client at its first reading.

  5. 5Add calendar and lag features

    After this chapter, you can turn one client's hourly history into a feature table, add lags and calendar and holiday features that a day-ahead forecast is allowed to see, measure what each feature adds on the same windows, and catch a lag that reads the day being forecast.

  6. 6Forecast many clients with one model

    You finish this chapter with one global model for all thirty clients, a start rule that keeps the late starters' leading zeros out of it, and a score that sets it beside seasonal naive for each client on the same cutoffs.

  7. 7Make the total add up

    You'll forecast the total demand of thirty clients two ways, choose between the two on decision windows, and split that total into client shares using only the history before each cutoff.

  8. 8Quantify forecast uncertainty

    This chapter puts a range around each day-ahead forecast, so you can say whether a purchase can rely on it.

  9. 9Compare Prophet and a foundation model

    Once you finish this chapter, you can fit Prophet on the book's three standard cutoffs, load a recorded foundation model (Chronos-2) and a recorded neural model (NHITS), and score all of them on one MASE scale against the same readings.

  10. 10Keep the forecast running

    Once a forecast runs every day, the question changes from whether it scored well to whether it still holds on the day it's used.

Cite this section

Format

Every format names this edition. Its link opens the current edition, where a section’s heading says when its text last changed. Accessed and retrieved dates are the day you open this.