Every chapter of this book is built from a small set of recurring elements, each with a specific job. This page is a live preview and a legend: the boxes, code, and figures below are real samples of what you will meet on nearly every page, so you can learn to read the book's visual language before Chapter 1. Each element below is shown in the exact style it carries throughout the text.
The Shape of the Journey
Figure F4.1 shows the nine-part arc as one movement from describing time, to predicting it, to acting on it. The recurring ideas (filtering, recurrence, decision making) travel left to right across the whole sequence.
Epigraphs: A Light Beginning
Every section opens with a short quotation from a fictional temporal-AI persona, a Kalman filter, an overconfident forecaster, a reinforcement learner still exploring, whose complaint or boast captures the section's theme. The one below is typical of the species.
"I conditioned on a return I cannot reach, predicted the action that would reach it, and called the gap between us a learning opportunity."
A Decision Transformer Conditioning on a Return It Cannot Reach
Callouts That Carry the Argument
Colored boxes do structured work throughout the book. A Big Picture box opens each section and tells you where you are in the larger story; the sample below shows the format.
Boxes like this one start every section. They state what the section teaches, why it matters now, and how it connects backward and forward along the temporal thread, so you are never more than a paragraph away from knowing why you are reading.
A Key Insight box distills the one idea worth remembering after the details fade, like the unifying claim below.
The Kalman filter, the recurrent network, and the structured state-space model are the same recurrence seen three ways: a fixed estimator, a learned one, and a learned one made parallel. Recognize the pattern once and three chapters collapse into one idea.
From Scratch, Then the Library: The "Right Tool" Principle
Whenever the book builds something from scratch, it also shows the production version. The from-scratch code teaches; the library call ships. The pair below forecasts a series first by hand, then in two lines, and each block carries a specific caption underneath.
import numpy as np
def ar1_forecast(series, phi, steps):
"""One-step AR(1) recursion: x[t] = phi * x[t-1], rolled forward."""
last = series[-1]
preds = []
for _ in range(steps):
last = phi * last # propagate the linear recurrence
preds.append(last)
return np.array(preds)
history = np.array([10.0, 9.2, 8.6, 8.1])
print(ar1_forecast(history, phi=0.92, steps=3)) # [7.45, 6.86, 6.31]
After a section derives the recurrence above and fits the coefficient by hand, a box like this shows the production equivalent in two lines:
from statsforecast.models import AutoARIMA
model = AutoARIMA().fit(history)
forecast = model.predict(h=3)["mean"]
Worked Numbers and Real Stories
A Numeric Example box carries a calculation through with concrete values, so the math is never left abstract.
With $\phi = 0.92$ and a last value of $8.1$, the AR(1) forecast for the next three steps is $0.92 \times 8.1 = 7.45$, then $0.92 \times 7.45 = 6.86$, then $0.92 \times 6.86 = 6.31$. Each step multiplies the previous one by $\phi$, so the forecast decays geometrically toward zero, which is exactly the long-run mean of a zero-intercept AR(1).
A Practical Example box tells a realistic industry mini-story: who faced the problem, what they decided, and what it cost or saved.
An energy retailer's day-ahead load forecaster, accurate for two years, began over-predicting every Monday after a tariff change shifted customer behavior. The team traced it to a stale seasonal component, added a drift detector that triggered weekly refitting, and cut Monday error by a third without touching the model architecture. The fix lived in the monitoring loop, not the network.
The Frontier and the Exercises
A Research Frontier box connects the material to work from 2024 through 2026, with named methods and papers.
Temporal foundation models (Chronos, TimesFM, Moirai, MOMENT) now forecast series they were never trained on, the way a language model completes unseen text. Whether such zero-shot forecasters consistently beat a well-tuned classical baseline remains an open and actively debated question, and Chapter 15 takes it up directly.
Each section closes with two or three exercises spanning three types: theory (reason about or prove something), implementation (build or modify a pipeline), and open-ended (investigate and interpret). They arrive in the box below.
Extend the from-scratch AR(1) forecaster above to an AR(p) model that takes a vector of coefficients. Fit it to one of the book's three running datasets by least squares, then compare its multi-step error against the AutoARIMA shortcut. Report where the hand-rolled model wins, where it loses, and why.
The Hands-On Lab and the Per-Chapter Scaffold
Every chapter ends with a Hands-On Lab: a single guided exercise that assembles the chapter's ideas into one runnable artifact on a real dataset, from loading and leakage-safe splitting through model fitting, evaluation, and a short written interpretation. The lab is where the chapter's separate pieces become one working pipeline you can keep.
Underneath every chapter runs the same nine-point pedagogical scaffold: learning objectives, a motivation and running example, the core exposition with derivations and figures, fully worked examples, a classical-to-neural bridge box that names the related method elsewhere in the book, an end-to-end case study on one of the three running datasets (finance, healthcare, sensor/IoT), a pitfalls-and-practice section on leakage and common failures, three-flavor exercises, and a curated further-reading list. Each chapter index closes with a What's Next bridge to the following chapter and an annotated bibliography of 8 to 15 real, hyperlinked references.
That is the toolkit. The next page shows how to route your own path through it.