---
title: Sliding Window Path Signature (SW-PS)
url: https://www.emergentmind.com/topics/sliding-window-path-signature-sw-ps
type: topic
---

# Sliding Window Path Signature (SW-PS)

The Sliding Window Path Signature (SW-PS) is a feature extraction methodology that combines concepts from rough path theory and modern sequence modeling. SW-PS is designed to compute succinct, translation- and rotation-invariant representations of streaming trajectory data—such as online handwritten character strokes—by applying the path signature transform within a moving window over the signal. This yields local, algebraic features that can then be input to efficient sequence models such as Linear Recurrent Units (LRUs). The SW-PS approach is principally motivated by the need for robust sequence representations in the presence of deformations (e.g., rotation, translation) and non-stationary statistics across a signal, while maintaining computational tractability for both training and inference on long sequences.

## 1. Mathematical Foundations of the Sliding Window Path Signature

SW-PS builds on the path signature map: a construction from stochastic analysis where a continuous path is embedded into a graded tensor algebra via iterated integrals. For a $d$-dimensional path $X_t \in \mathbb{R}^d$ on $[a, b]$, the order-$m$ signature over interval $[s, t]$ is defined as
\[
S^{(m)}(X)_{[s,t]} = \left\{ \int_{s<u_1<\cdots<u_m<t} dX_{u_1} \otimes \cdots \otimes dX_{u_m} \right\}_{m\geq 1} 
\]
The key properties of the signature transform include:
- **Translation invariance:** $S^{(m)}(X+c) = S^{(m)}(X)$ for any constant $c$.
- **Algebraic universality:** The truncated path signature up to degree $M$ forms a feature space dense in the space of continuous functionals on fixed-length paths.

The "sliding window" variant computes the truncated path signature of order $M$ on each window $[t, t+\ell)$ as the window moves over sampled path data $\{x_k\}$, yielding the SW-PS feature sequence:
\[
\text{SW-PS}_{t}^{(M,\ell)} = S^{(M)}(\{x_{t},\ldots,x_{t+\ell-1}\})
\]
The window length $\ell$ and signature truncation order $M$ are hyperparameters governing spatial and geometric locality, respectively.

## 2. SW-PS in Online Handwritten Character Recognition

The canonical application of SW-PS is in online handwritten character recognition tasks where each character is captured as a sequence of 2D or 3D pen positions. The rich local structure encoded by short path signatures captures distinctive geometric primitives (corners, curves, directional changes) and is robust to global transformations.

In "Rotation-free Online Handwritten Character Recognition Using Linear Recurrent Units" [2602.01533], the SW-PS is used to map each sliding window of a stroke sequence into a 90-dimensional vector (with $\ell = 5$, $M = 3$). This high-level procedure is:
- For each $t$ in the stroke sequence, compute $\text{SW-PS}_{t}^{(M=3,\ell=5)}$.
- Stack the SW-PS features into a new sequence $\{x_t'\}$ for input to an LRU-based classifier.
This approach yields rotation invariance and substantial gains in accuracy and convergence robustness under adversarial geometric perturbations.

## 3. Integration with Linear Recurrent Units

SW-PS is designed specifically to provide input features compatible with sequence models that efficiently process long dependence structures. LRUs are an optimal downstream model:
- The LRU maintains a hidden state via a linear recurrence $h_t = A h_{t-1} + B x_t$ where $A$ is complex-diagonalizable, yielding stable evolution and efficient parallelism [2310.02367, 2303.06349].
- The stacked LRU blocks, often with normalization, nonlinear gating such as GELU/GLU, and residual connections, process the SW-PS feature sequence and yield class probabilities after pooling and MLP projection.

Combined, SW-PS and LRU architectures yield:
- O(T) memory and compute per sequence for inference.
- Fully parallelized training via diagonalization and convolutional realization of the recurrence.
- Empirically, these systems converge faster and outperform RNNs and self-attention models on stroke-recognition benchmarks ([2602.01533]).

## 4. Computational Complexity and Parallelism

The computational efficiency of SW-PS+LRU arises from both the local nature of SW-PS and the algebraic structure of LRUs:
- The SW-PS feature extraction scales as $O(L \ell d^M)$, where $L$ is the sequence length, due to overlapping windows and polynomial signature enumeration.
- LRUs, after diagonalization of $A$, admit per-step $O(d)$ cost and a parallel scan implementation that achieves $O(\log T)$ evaluation depth for sequence of length $T$ [2303.06349, 2310.02367].
- Compared to attention-based models with $O(T^2)$ cost, the SW-PS+LRU workflow retains suitability for real-time and embedded applications.

## 5. Empirical Results and Robustness Properties

In recognition tasks with extreme geometric augmentation (random rotation up to $\pm 180^\circ$), the SW-PS+LRU system exceeds prior models in test accuracy ($99.62\%$ for digits, $96.67\%$ for uppercase English letters, $94.33\%$ for Chinese radicals) on CASIA-OLHWDB1.1 [2602.01533]. The SW-PS transforms provide robust, invariant descriptors, enabling rapid convergence and accuracy advantages. The system is also conducive to ensemble learning, further improving generalization.

## 6. Implementation Considerations and Limitations

Extending SW-PS to new domains requires:
- Careful tuning of window length $\ell$ and signature degree $M$ to balance locality and capacity.
- Memory management for overlapping window computation in long sequences.
- Efficient software, possibly leveraging fast signature computation libraries and specialized CUDA kernels for LRU parallel scan.

A possible limitation is the cubic growth of feature dimension in signature order $M$, which may be addressed by truncation, sparsity, or learned selection.

## 7. Significance and Prospects

The SW-PS paradigm demonstrates the practicality of algebraic, windowed feature transforms combined with state-space inspired sequence models such as LRUs. This approach achieves strong invariance properties and competitive performance for time-series and spatio-temporal recognition, with a favorable complexity profile and suitability for parallel hardware [2602.01533, 2310.02367]. Further research may focus on automatic selection of window parameters, integration with end-to-end differentiable models, and extension of SW-PS to higher-dimensional or multimodal sequence data.

Source: https://www.emergentmind.com/topics/sliding-window-path-signature-sw-ps