arXiv(opens in a new tab)cs.LGSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.05136

MomentQuant: an even more minimalist interval method with linear time complexity for time series classification

Johann Faouzi

Abstract

Time series data is very common in many real-world applications and in numerous domains, with increasing interest for automated information extraction using machine learning. One of these subfields is time series classification, which consists in assigning a label to each new, unseen time series. Many algorithms have been developed over the past decades, with the trade-off between predictive performance and computational cost being consistently discussed. Quant, an interval-based algorithm extracting quantiles from recursive, fixed, dyadic intervals, was shown to achieve high accuracy, while being very fast. We propose two changes to make this algorithm even faster. The first one is a better optimized implementation of the exact same algorithm. The second one is to derive approximate quantiles, using the Cornish-Fisher expansion, instead of exact quantiles. This change removes the necessity to sort the time series, leading to a smaller computational complexity. We call this novel algorithm MomentQuant. We provide evidence that our implementation of Quant is faster than the original one, and that MomentQuant is even faster than our implementation of Quant, at the cost of a tiny decrease in predictive performance. These improvements are especially relevant for real-life applications, where inference is performed much more often than training.

Keywords: time series classification, time series, classification, machine learning, supervised learning, feature extraction, quantiles, moments

1 Introduction

Time series classification is the supervised learning task of assigning a discrete label to a time-ordered sequence of measurements, and it arises across a wide range of application domains, including health monitoring, industrial process control, astronomy, and human activity recognition. Because the discriminative structure of a time series can lie in its overall shape, in local patterns, or in its frequency content, depending on the domain, methods that perform consistently well across many kinds of data sets typically combine features extracted from several complementary representations of the input series rather than committing to a single one. The introduction and steady growth of the University of California, Riverside (UCR) time series archive (Dau et al., 2019), a public collection of benchmark data sets spanning dozens of application domains, made it possible to compare such methods systematically, and has driven two decades of active method development in the field.

This growth has, however, exposed a persistent tension between predictive accuracy and computational cost. The most accurate methods on the UCR archive are typically large, heterogeneous ensembles combining several complementary representations and classifiers, such as the Hierarchical Vote Collective of Transformation Ensembles (HIVE-COTE) 2.0 (Middlehurst et al., 2021). Their accuracy gains come at a steep computational price, often requiring hours or days to train and test even on the comparatively small (by modern machine learning standards) UCR data sets, which makes them impractical to scale to larger data sets or to apply repeatedly, e.g., for hyperparameter tuning. This tension motivated a distinct line of work seeking to reproduce most of that accuracy at a small fraction of the cost, most prominently the Random Convolutional Kernel Transform (ROCKET) algorithm (Dempster, Petitjean, & Webb, 2020) and its successor MiniRocket (Dempster, Schmidt, & Webb, 2021), which summarize each series through a large bank of (random or fixed) convolutional kernels and train a linear classifier on the resulting features, reaching near-state-of-the-art accuracy while being orders of magnitude cheaper to train than the heterogeneous ensembles above.

Quant (Dempster, Schmidt, & Webb, 2024) is a recent, markedly simpler entry in this second line of work. Rather than convolutional kernels, it computes a single type of feature, empirical quantiles, from a fixed, hierarchical set of intervals of each series, over four complementary representations of the series (the raw series, a smoothed first-order difference, the second-order difference, and the magnitude of its discrete Fourier transform), and feeds the concatenated quantiles, unchanged, to an off-the-shelf tree ensemble classifier. Despite this minimalism, and despite using a single feature type where most interval-based methods before it combined several, Quant matches the accuracy of the most accurate interval-based methods on the UCR archive, and stays close in aggregate accuracy to the very best, much more expensive heterogeneous ensembles. Quant only needs, by the original authors' own account, under fifteen minutes of combined training and inference time on a single central processing unit (CPU) core to process the 142 univariate data sets of the UCR archive (Dempster et al., 2024).

Although Quant's overall speed is undeniable, its computational complexity has not been established so far. The original publication has a short section on this topic, but does not provide an in-depth analysis (Dempster et al., 2024). The authors mention that they “treat the computational cost of sorting the values as an upper bound on the cost of computing the quantiles: O(l⋅log⁡(l))\mathcal{O}(l \cdot \log(l)), where ll is the time series length”. However, the subseries from each interval are also sorted, not just the whole time series, in order to compute the quantiles. Moreover, the authors do not prove that the cost of computing the quantiles is upper bounded by the cost of sorting the values. The authors also provide the computational complexity of the training of the classification step of Quant, and their results demonstrate that the training the classification step is the longest part of the whole pipeline. Overall, the original publication overlooks the computational complexity of the transformation step, as if it was irrelevant compared to the computational complexity of the classification step. We will demonstrate that this analysis does not hold when considering only the inference phase of the algorithm, which is very relevant for real-life applications of any machine learning model, and is too often overlooked in the time series classification literature. We will also provide an in-depth analysis of the computational complexity of Quant, both theoretical and practical.

Quant’s overall speed does not mean that every part of its reference implementation1^{1} is equally well suited to every setting that it is run in. The implementation commits to a single, fixed computational structure: one call to PyTorch’s batched torch.quantile function per interval, amortized over the whole batch of series at once. This is a natural design for a tensor library built around batched, hardware-accelerated execution. However, it is not well-matched to either end of the series-length spectrum on a single CPU core, the setting that Quant’s own headline runtime figures above were obtained in, as we detail in Section 3. For short series, the fixed per-call dispatch overhead of this design, paid once per interval regardless of how little work that interval actually requires, comes to dominate the total cost. For long series, the same design instead pays a growing sorting cost, since exactly computing a set of quantiles from ll raw values requires first sorting them, which is an O(l⋅log⁡(l))\mathcal{O}(l \cdot \log(l)) operation.

This paper addresses both regimes, but its main contribution targets the long-series one. We reimplement Quant from scratch in NumPy, both to reproduce the original algorithm faithfully as an exact mode, which we further speed up for short series (Section 5) by choosing between two different loop orderings for the same computation, guided by a full theoretical cost analysis (Section 4). Then, we introduce a genuinely new approximate mode aimed at long series. Instead of sorting each interval to obtain its exact quantiles, this approximate mode estimates them directly from that interval’s own sample mean, variance, skewness, and excess kurtosis. These four quantities are computable in a single O(l)\mathcal{O}(l) pass, via the Cornish-Fisher expansion (Cornish & Fisher, 1938; Fisher & Cornish, 1960), a classical asymptotic correction of the standard normal quantile for a distribution’s departure from normality. Doing so trades the exact mode’s O(l⋅log⁡(l))\mathcal{O}(l \cdot \log(l)) sorting cost for an O(l)\mathcal{O}(l) moment-based one, at the cost of a small, and, as we show empirically, largely controllable approximation error. Concretely, this paper makes the following contributions:

  • A precise theoretical cost model, with proofs, for the exact mode and its two natural loop orderings (Section 4 and Section 5), and for the new approximate mode

1^{1}https://github.com/angus924/quant

(Section 6), including a closed-form asymptotic characterization of how each mode's total cost scales with series length.

  • A moment-based approximate mode for Quant built on the Cornish-Fisher expansion, together with an empirical study of its quantile-approximation fidelity and of the resulting accuracy and runtime trade-off, conditioned on series length, across the 142 univariate data sets of the UCR archive (Section 6 and Section 8).

  • An automatic dispatch heuristic for each mode (exact and approximate), calibrated per machine, that selects between the loop orderings, based on the series length at hand (Section 6, Section 8).

  • A comprehensive, single-threaded and multithreaded analysis of an optimization that was mentioned in (Dempster et al., 2024), but neither implemented nor evaluated (Section 9).

The remainder of this paper is organized as follows. Section 2 provides some background, with an overview of the time series classification literature, the interval-based methods, and Quant. In Section 3, we explain the specific limitations of Quant's reference implementation that motivate this paper. Section 4 develops a theoretical cost model for processing a single series under Quant's exact quantile computation. Section 5 uses this model to choose, for the exact mode, between two loop orderings depending on series length. In Section 6, we introduce the moment-based approximate mode built on the Cornish-Fisher expansion, together with its own cost model. Section 7 presents our experimental setup, while Section 8 presents all our results. We investigate the optimization mentioned in Quant's original publication in Section 9, before concluding in Section 10.

References (59)