Segmentation, Warping and Clustering of Multivariate Time Series in PythonThe mvtsa toolbox

Preface

Most of the data that a chemical plant, a power station or a production line records are multivariate time series: dozens or hundreds of variables sampled every second, minute or hour for years. The information an engineer needs is rarely in a single variable. It is in how the variables move together: a feed and a temperature that stop following each other, a correlation structure that changes when the reactor switches to a new product grade, a sequence of operating regimes that repeats every campaign. Three questions return again and again. Where does the behaviour of the process change? How similar are two records whose time axes do not agree? Which records, segments or units belong together?

This book and the mvtsa package answer these questions. They grew out of two decades of work of my group at the University of Pannonia (University of Veszprém until 2006). It started with the observation that segmenting a multivariate series is a constrained clustering problem, and that principal component models measure the homogeneity of a segment much better than the means of the variables: a segment is homogeneous if one PCA model describes all of its samples. The fuzzy segmentation algorithm built on this idea, a modified Gath–Geva clustering with probabilistic PCA models and Gaussian memberships in time, was published with Balázs Feil, Sándor Németh and Péter Árva [1, 2]; Kalman filtering made it applicable to noisy process transitions [3]. Zoltán Bankó turned the PCA costs into a bottom-up segmentation and, from there, into correlation-based dynamic time warping, which compares multivariate series by the sequence of their correlation structures [4, 5]; his doctoral work added dynamic PCA, a mixed dissimilarity measure for piecewise linear approximations and the tightness of warping [6, 7, 8]. Balázs Balaskó compared process trends by aligning their qualitative episodes [9, 10]. László Dobos developed the on-line, recursive dynamic-PCA segmentation and the segmentation of historical data by the Fisher information they carry for parameter estimation [11, 12, 13, 14, 15]. Model-based segmentation found its way into energy monitoring [16], decision trees into the description of operating regimes [17], fuzzy Sammon mapping into the visualization of clusters of trajectories [18]; more recent work clusters trajectories by neighbourhood preservation [19] and gives visibility graphs the meaning of statistical process control zones [20].

These methods were published in journals and conference proceedings and implemented in MATLAB. The field around them has grown enormously in the meantime: exact penalized change point detection, Bayesian on-line detection, self-supervised segmentation, soft and differentiable alignment, shape-based clustering, large benchmarks and statistical comparison protocols. This book places our methods among the best of these, implements them all in one Python package, and adds what a practitioner needs around them: evaluation, validation, explanation, simplification and the operation of the models in production. Several methods are new: merge persistence and the segmentogram of the bottom-up hierarchy, predictive homogeneity with any scikit-learn model, consensus segmentation, Riemannian and mixed local distances for correlation-based warping, and episode warping.

How the book is organized. Chapters 1 and 2 introduce the questions, the package and the common foundations: notation, segmentations as partitions, warping paths, PCA models and their statistics. Chapter 3 collects the representations that the later methods build on. Chapters 4 to 6 are about segmentation: cost-based methods and their search strategies, latent-variable methods – the core of our own work – and the probabilistic, profile-based and state models of the recent literature. Chapters 7 and 8 are about warping: the family of elastic measures, then correlation-based and segment-level warping. Chapter 9 groups series, segments and trajectories. Chapters 10 to 12 turn methods into trustworthy tools: evaluation and validation, visualization and explanation, model operations. Chapter 13 brings everything together in three case studies. The appendices list the API, the example scripts, and every method with its origin.

How to read it. Every chapter starts with a short roadmap and ends its theory sections with a summary box; algorithms are stated in boxes, concepts are drawn as diagrams. Every figure that shows a computed result is produced by one of the forty-eight example scripts of the package, and the code printed in the book is cut from these scripts, so what you read is what runs. The scripts are also available as Jupyter notebooks in the online documentation. A reader interested in a single method can go directly to its section and its example; the notation is the same everywhere (table 2.1).

Acknowledgements. The methods of this book are the work of many people. I am grateful to my former and present doctoral students and co-authors – Zoltán Bankó, Balázs Feil, Balázs Balaskó, László Dobos, Sándor Németh, Péter Árva, Ferenc Szeifert, Tamás Varga, Tibor Kulcsár, Bálint Levente Tarcsay, Martin Ferenczi and Alex Kummer – for the ideas, the experiments and the many discussions behind them. The research summarized in this book was supported by the National Research, Development and Innovation Office of Hungary (NKFIH) through the OTKA 143482 project.

Veszprém, November 2026 János Abonyi