Book Review: Time Series with PyTorch

I was offered to read Time Series with PyTorch by Graeme Davidson and Lei Ma in exchange for an honest review. Time-series forecasting is one of the most challenging areas of machine learning for me, and many deep learning books treat it as an afterthought added after computer vision and NLP. This book is a practical guide for people who already know some Python and statistics but have not done much deep learning for temporal data. It starts with what makes time series hard, builds neural networks from first principles in PyTorch, and then demonstrates modern time-series architectures. After that, it goes beyond point forecasting and teaches classification, clustering, anomaly detection, and self-supervised learning. I liked that correct evaluation plays an important role in each chapter.
The overall structure
The book is organized into three broad sections:
- Foundations (Chapters 1-7): what makes time-series data hard (missing data, decomposition, stationarity), how to evaluate forecasts correctly, building and optimizing neural networks, and calibrating them with conformal prediction intervals.
- Architectures (Chapters 8-13): the major neural families: RNN, transformers, N-BEATS, N-HiTS, CNNs, graph neural networks, and other models.
- Beyond point forecasting (Chapters 14-18): classification, clustering, embeddings, anomaly detection, and self-supervised learning, which is a wider set of temporal tasks than most forecasting books address.

The two authors write differently: Graeme Davidson comes from cognitive neuroscience and leans on systems and experimentation; Lei Ma is a physicist and leans on first-principles intuition. As an example, the recurrent-networks chapter opens with a swing on a playground, and the evaluation and benchmarking chapters read like notes from someone who has lost money to a bad backtest.
You need Python 3.10+ and PyTorch, and a GPU helps for the later chapters but is not required. The early chapters build models from scratch, and later the book leans more on libraries (Nixtla’s NeuralForecast and statsforecast for forecasting, aeon for the classification and clustering work) to avoid drowning the reader in code.
What I liked

The evaluation chapter is the best thing in the book. Instead of just listing error-metric formulas, the authors show a toy example in which a model that predicts values close to the actual values achieves a higher MAPE than a clearly worse model, and use it to explain why percentage errors reward underforecasting.

The chapter discusses data leakage at length: transformation-based leakage, lookforward bias from lagged features, and panel-data leakage across series. A forecast built with leaked lag features tracks the test set suspiciously well, whereas the honest recursive version diverges as real forecasts do. In Kaggle time-series competitions, this is a common difficulty: the leaderboard is unforgiving of a validation setup that looks into the future, and I like that the book makes the failure visible.

The diffusion chapter explains its concept using an example of a drop of ink in water. Particles start almost uniformly distributed in a one-dimensional tube and get nudged by random forces, and if you simulate a thousand of them and plot their positions every ten steps, you watch the flat distribution relax into a Gaussian: the forward diffusion process, made physical before a single line of probability. The reverse process, recovering the ink drop, is then the generative model. This was a very cool explanation of the diffusion process

Conformal prediction gets a full chapter, which is unusual for a forecasting book. Rather than starting from the coverage guarantee, the authors build a conformity ladder: rank your calibration points by how badly the model missed them, then read an interval off the ranking. The figure shows what happens when you move one point to an extreme - its rank drops and the whole ladder reshuffles.
And I had fun reading the examples from the M5 Walmart competition - I participated in that competition and failed hard, so it was interesting to see a variety of models and evaluation methods applied to the same data I had seen before.
What could have been better
There are a few small things I would have wanted more of:
- Foundation models are mentioned briefly, but nowadays many of them work relatively well (or at least claim to). Lag-Llama, TabPFN, Chronos, and TimeGPT are mentioned, but it would be interesting to see a couple of practical examples of using them.
- The generative chapters use toy data. The variational autoencoder and the diffusion model only generate sine waves; real data would have made the case more convincing.
- The later chapters, embeddings and self-supervised learning especially, are thinner than the earlier ones and lean heavily on the Nixtla and aeon libraries.
But these are small nitpicks that are completely overshadowed by the good sides of the book.
Conclusion
This book is a good fit for data scientists and ML engineers who are comfortable with Python and want to move from classical or black-box forecasting to deep learning while maintaining evaluation discipline. If you already do time-series work and have felt that the deep learning material is scattered across papers and library docs, this brings much of it together in one place and builds it up quite well. The main ideas the book asserts are: understand the data before the model, pick your metric on purpose, guard against leakage, and check whether a model actually beats a naive baseline before believing it.
