Randomized Time Warping (RTW)
- RTW is a set of sequence analysis methods defined by randomized subsequence sampling and subspace matching techniques that preserve DTW’s temporal elasticity.
- RTW replaces exhaustive dynamic programming with random sampling and PCA-driven canonical-angle comparisons, reducing computational cost and mitigating diagonal dominance.
- RTW comprises two main formulations: one for motion recognition using TE features and subspace analysis, and another using random warping series to build alignment-aware feature maps.
Randomized Time Warping (RTW) denotes a set of sequence-analysis methods that preserve the elastic-alignment motivation of Dynamic Time Warping (DTW) while replacing exhaustive path-based comparison with randomized constructions. In current arXiv usage, the term most directly refers to a general extension of DTW for sequence comparison and recognition that uses randomized, order-preserving sampling of subsequences, PCA-derived “hypo subspaces,” and canonical-angle similarity, with an interpretation as an attention mechanism in motion recognition (Hiraoka et al., 22 Aug 2025). A separate established usage realizes RTW through Random Warping Series (RWS), where each time series is aligned to short random warping series to obtain an explicit alignment-aware random-features embedding and a positive definite kernel (Wu et al., 2018). Across these formulations, randomness enters through sampled subsequences or sampled warping series rather than through a single deterministic optimal path.
1. Terminology and scope
The expression “Randomized Time Warping” is not attached to a single universally adopted formalism. At least two technical lineages are documented in the recent literature.
| Formulation | Core mechanism | Representative source |
|---|---|---|
| Randomized Time Warping for motion recognition | Randomized, order-preserving sampling of subsequences; PCA hypo subspaces; canonical angles; attention interpretation | (Hiraoka et al., 22 Aug 2025) |
| Randomized Time Warping via Random Warping Series | Alignment to short random series; explicit feature map; positive definite kernel; Monte Carlo random features | (Wu et al., 2018) |
| RTW as acronym for a different concept | Riemannian manifold-aware multiple sequence alignment | (Richter et al., 2 Jun 2025) |
This terminological plurality matters because the acronym RTW is not semantically unique. In “Riemannian Time Warping: Multiple Sequence Alignment in Curved Spaces,” RTW stands for Riemannian Time Warping, not randomized time warping (Richter et al., 2 Jun 2025). Two additional neighboring lines of work further widen the conceptual field: one studies estimation from randomly time-warped observations without naming a method RTW (Bayram, 2021), and another develops a stochastic process model for time warping functions that can be used to generate random warpings in a principled way (Ma et al., 2022).
A common source of confusion is therefore the assumption that RTW always denotes one algorithmic pipeline. The literature instead supports a narrower and more precise statement: RTW refers either to a randomized DTW extension built from sampled subsequences and subspace geometry (Hiraoka et al., 22 Aug 2025), or to an alignment-aware random-features construction built from random warping series (Wu et al., 2018), while other papers use the same acronym for unrelated manifold-based alignment (Richter et al., 2 Jun 2025).
2. DTW as the baseline that RTW generalizes or bypasses
Classical DTW aligns two sequences and by finding an admissible alignment path from to that minimizes accumulated local dissimilarity: The admissible paths satisfy boundary conditions, monotonicity, and continuity, and the standard dynamic-programming solution operates on a cost matrix with typical time and space complexity , often written as when the two lengths are comparable (Hiraoka et al., 22 Aug 2025).
The same baseline appears in the RWS literature in a slightly different notation. For time series and 0, DTW is written as
1
with the dynamic-programming recurrence
2
plus standard boundary initialization and, optionally, a Sakoe–Chiba warping window 3 (Wu et al., 2018).
The technical motivation for RTW follows from the computational and statistical limitations of DTW and its kernelized descendants. In the RWS account, DTW-inspired global-alignment kernels suffer from diagonal dominance of the Gram matrix and quadratic complexity with respect to the sample size, since evaluating all pairwise kernel values requires 4 dynamic-programming runs, each with 5 cost in the unwindowed case, for a total of 6 time (Wu et al., 2018). In the motion-recognition account, DTW’s single optimal path is replaced by randomized sampling of many order-preserving subsequences, and the computational focus shifts from path search to subspace estimation and canonical-angle comparison (Hiraoka et al., 22 Aug 2025).
This suggests a unifying interpretation: RTW methods keep temporal elasticity as the central modeling objective, but they randomize the representation of possible warpings so that the algorithm need not commit to one explicit global path.
3. Randomized Time Warping as randomized subsequence sampling and subspace matching
In the motion-recognition formulation, RTW is a general extension of DTW that forgoes a single optimal warping path and instead represents many possible time-warped patterns through randomized, order-preserving sampling of subsequences called Time Elastic (TE) features (Hiraoka et al., 22 Aug 2025). The input is a sequence of 7 deep feature vectors 8, with 9.
A TE feature is formed by sampling 0 indices 1 and concatenating the corresponding frame features: 2
3
Repeating the randomized, order-preserving sampling 4 times yields a set 5, and an analogous set 6 is built for a reference sequence (Hiraoka et al., 22 Aug 2025). The stated effect is to induce a diverse collection of time-elastic patterns covering local to global scales, thereby approximating multiple warping possibilities that DTW would otherwise consider through path search.
The TE feature sets are then compressed into low-dimensional hypo subspaces by PCA. Writing
7
the orthonormal basis matrices 8 and 9 are taken as the eigenvectors corresponding to the 0 largest eigenvalues of 1 and 2, respectively (Hiraoka et al., 22 Aug 2025). Structural similarity between the two subspaces is then measured with the Mutual Subspace Method (MSM): if
3
and 4 are the singular values associated with the canonical angles 5, RTW defines
6
The classification pipeline is explicitly two-stage. In the learning stage, each training video of class 7 is converted into TE features by repeated random order-preserving frame sampling and deep feature concatenation; PCA is applied to obtain a reference hypo subspace; and this process is repeated across the 8 training videos of the class to obtain 9. In the inference stage, the input video is processed by the same TE sampling procedure, PCA yields an input subspace 0, MSM similarities are computed against the class-specific reference subspaces, and classification is performed by 1-nearest neighbors using the average of the top-2 similarities within each class (Hiraoka et al., 22 Aug 2025).
The complexity profile differs sharply from DTW. TE generation requires 3, PCA on 4 and 5 can dominate when 6 and 7 are large, and the MSM step itself is relatively light when the chosen subspace dimensions 8 are small (Hiraoka et al., 22 Aug 2025). The paper explicitly contrasts this with DTW’s 9 path-search cost and with Transformer self-attention’s 0 time and memory for the attention matrix.
4. Contribution weights, attention interpretation, and motion-recognition evidence
A distinctive claim of the 2025 formulation is that RTW’s core computational mechanism can be interpreted as a type of self-attention (Hiraoka et al., 22 Aug 2025). The derivation begins with explicit contribution weights connecting TE features, PCA, and canonical-angle computation back to per-time-step importance.
If 1 denotes the contribution of the 2-th TE feature to the 3-th canonical vector 4, the paper gives
5
where 6 and 7 are the linear-combination coefficients arising from PCA and MSM. If 8 denotes the contribution weight of the 9-th input element 0 to the 1-th TE feature 2, then
3
where 4 and 5 is the total number of sampled TE features that include 6. The contribution of 7 to the 8-th canonical vector is then
9
and the normalized RTW attention pattern is
0
with 1 (Hiraoka et al., 22 Aug 2025).
This construction is compared to Transformer self-attention, where
2
and
3
The paper aggregates attention toward each element 4 as 5. The stated analogy is that each RTW pattern 6 is a global weighting over the entire sequence, while the set 7 parallels 8 attention heads (Hiraoka et al., 22 Aug 2025). The key distinction is operational rather than superficial: RTW attention is computed over the entire input sequence through TE sampling and subspace analysis, whereas practical video Transformers often restrict attention to local or windowed views because naive self-attention requires an 9 matrix.
On Something-Something V2, the empirical alignment between RTW and Transformer attention patterns is reported through cosine-similarity-based pairing of RTW canonical-angle patterns and Transformer heads. Averaged across 174 classes, the per-pair correlations are described as high, including values such as 0, with overall average approximately 1 across the ten smallest canonical angles (Hiraoka et al., 22 Aug 2025).
The same study reports a classification advantage for RTW over a ViViT-style Transformer baseline on SSv2. The dataset comprises 193k training and 27k test videos across 174 classes, with sequences averaging 40 frames, maximum 119, and standard deviation 10 (Hiraoka et al., 22 Aug 2025). The Transformer baseline uses a two-stage design with a ViT pre-trained on ImageNet-21k for spatial features and a temporal Transformer with 10 heads operating on 16-frame views. RTW uses the same spatial features, 10 canonical angles, and TE features built from 16-frame clips.
| Method | Data fraction | Accuracy (%) |
|---|---|---|
| Transformer (ViViT-like) | Full | 46.84 |
| Transformer (ViViT-like) | 1/5 | 47.53 |
| Transformer (ViViT-like) | 1/10 | 45.63 |
| RTW 2 | Full | 51.06 |
| RTW 3 | 1/5 | 48.29 |
| RTW 4 | 1/10 | 46.74 |
| RTW 5 | Full | 51.18 |
| RTW 6 | 1/5 | 48.90 |
| RTW 7 | 1/10 | 47.30 |
| RTW 8 | Full | 51.34 |
| RTW 9 | 1/5 | 49.00 |
| RTW 0 | 1/10 | 47.65 |
| RTW 1 | Full | 51.11 |
| RTW 2 | 1/5 | 49.10 |
| RTW 3 | 1/10 | 47.82 |
The reported full-data comparison yields about a 5% absolute improvement for RTW over the Transformer baseline, for example 4 versus 5 (Hiraoka et al., 22 Aug 2025). The same source states that RTW trained on only 10% of the dataset, at 6, approaches the Transformer’s full-data performance of 7. Another common misconception is therefore directly addressed by the paper’s formulation: RTW does not “learn” its attention weights through gradient-based optimization; the weights are induced analytically by randomized sampling, PCA, and SVD (Hiraoka et al., 22 Aug 2025).
5. Random Warping Series: RTW as an alignment-aware random-features method
A distinct and earlier formulation of Randomized Time Warping is given by the Random Warping Series framework (Wu et al., 2018). Here the central object is not a hypo-subspace representation but an explicit feature map built by aligning each time series to a collection of short random series 8.
The kernel is defined as
9
with feature map
00
A crucial choice is the “hard alignment” distribution that places all mass on the optimal alignment: 01 The same feature can be written using alignment operators 02 as
03
where 04 is a ground dissimilarity such as 05 or squared 06 applied per aligned pair (Wu et al., 2018).
Monte Carlo approximation then produces an explicit 07-dimensional embedding: 08 with 09 (Wu et al., 2018). The sampled random series follow a specified distribution: the length 10 is drawn uniformly on 11, commonly with 12 and 13; the values are i.i.d. Gaussian with zero mean and variance 14; and a Sakoe–Chiba band such as 15 can be used to constrain the DTW alignment (Wu et al., 2018).
The theoretical claims are twofold. First, positive definiteness follows directly from the outer-product construction: 16 Second, the paper proves a uniform-convergence result for the random-features approximation on domains of time series of unbounded length, expressed in terms of a Minimum Shape-Preserving Length 17 and a sufficient number of features
18
with the bounded-length case giving 19 (Wu et al., 2018).
The computational advantage is explicit. DTW between a series of length 20 and a short random series of length 21 costs 22, which behaves as 23 when 24 is small or sampled from a small range. For 25 random series and 26 samples, the total cost is 27 time and 28 memory, in contrast to the 29 time and 30 memory of DTW-based global-alignment kernels (Wu et al., 2018). The paper also argues that the hard-min construction avoids diagonal dominance because the feature 31 depends on the single optimal alignment rather than a soft sum over exponentially many paths.
Empirically, the RWS study reports experiments on 16 UCR benchmark datasets for classification and clustering. Concrete examples include Two_Patterns, where RWS(SR) achieves 32–33 accuracy in 34–35 seconds versus 36–37 seconds for 1NN-DTW, and Wafer, where RWS(SR) achieves 38 in 39 seconds versus 40 in 41 seconds for 1NN-DTW (Wu et al., 2018). Against TGAK, the reported contrasts are stronger: on Wafer, RWS(SR) obtains 42 in 43 seconds versus 44 in 45 seconds for TGAK; on MALLAT, the comparison is 46 in 47 seconds versus 48 in 49 seconds (Wu et al., 2018). The paper’s practical guidance recommends 50, 51, 52, 53, and a modest Sakoe–Chiba window.
6. Related stochastic models, adjacent formulations, and naming ambiguities
Several nearby papers study random time warpings without using the exact RTW formalism of either subsequence/subspace RTW or RWS. These works are useful for delimiting what Randomized Time Warping is and is not.
“Time-Series Estimation from Randomly Time-Warped Observations” considers the observation model
54
with random warpings 55 that are close to identity, for example 56 where 57 is drawn from a zero-mean stationary Gaussian process (Bayram, 2021). The paper’s proposed estimator does not use DTW; instead it constructs a sparse graph Laplacian over observed signals, repeatedly solves discrete Dirichlet problems with random boundary seeds, defines centrality by inverse temperature variance, and estimates the template by averaging the most central observations. It further shows that naive ensemble averaging converges to a blurred version 58, which motivates selecting near-unwarped observations rather than averaging all warped ones (Bayram, 2021). The paper explicitly states that it does not use “RTW” as a named method; RTW there refers only to the generative setting of random time warpings.
“A Stochastic Process Model for Time Warping Functions” also does not explicitly discuss Randomized Time Warping by name, but it supplies a mathematically rigorous way to generate random warpings (Ma et al., 2022). The key construction maps a warping function 59 to the centered logratio transform of its derivative,
60
which places the problem in a zero-mean 61 Hilbert subspace. Sampling a finite stochastic expansion
62
then induces a valid random warping through
63
The paper presents this as a generative model for warping functions in 64, supports functional PCA, ANOVA, and regression in the transformed space, and develops a Bayesian registration method with efficient gradient-based MAP estimation (Ma et al., 2022). A plausible implication is that this framework can serve as a principled prior or generator for RTW-style randomization, although the paper itself does not define such an algorithm.
Finally, the overloaded acronym RTW must be distinguished from “Riemannian Time Warping: Multiple Sequence Alignment in Curved Spaces,” where RTW denotes a manifold-aware method for multiple sequence alignment on Riemannian manifolds (Richter et al., 2 Jun 2025). That method performs windowed sinc interpolation in tangent spaces, computes a Karcher mean trajectory by Gauss–Newton, and optimizes monotone warpings with a Gaussian-windowed geodesic loss and monotonicity penalty. It is therefore related to time warping at the problem level, but not to randomized time warping in the sense of sampled subsequences or random warping series.
Taken together, these papers delimit the encyclopedia meaning of Randomized Time Warping. In the strictest sense, RTW refers to randomized constructions that replace or approximate explicit alignment search, either through TE-feature sampling and canonical-angle subspace comparison in video recognition (Hiraoka et al., 22 Aug 2025) or through random-warping-series feature maps and positive definite kernels in time-series embedding (Wu et al., 2018). In a broader sense, the adjacent literature on random warp generative models and randomly time-warped observations provides the probabilistic and inferential background against which those RTW methods can be understood (Bayram, 2021, Ma et al., 2022).