KV-Match: A Subsequence Matching Approach Supporting Normalization and Time Warping

Jiaye Wu, Peng Wang, Ningting Pan, Chen Wang, Wei Wang, Jianmin Wang

Introduction

In time series mining—critical for applications ranging from IoT sensor monitoring to data center log analysis—identifying patterns within massive datasets is a fundamental task. Subsequence matching typically falls into two categories: Raw Subsequence Matching (RSM), which seeks exact value correspondences, and Normalized Subsequence Matching (NSM), which identifies similar "shapes" by accounting for vertical offset and scale (z-normalization).

While RSM can be efficiently indexed using multi-dimensional trees, NSM has traditionally been considered "un-indexable." Because z-normalization parameters (mean and standard deviation) vary for every sliding window, pre-calculating a fixed index key is difficult. Consequently, state-of-the-art NSM methods like the UCR Suite rely on highly optimized linear scans. However, as datasets scale toward trillions of points, even the fastest linear scan becomes a significant bottleneck.

Constrained Normalized Subsequence Matching (cNSM)

To overcome the indexing limitations of NSM, this paper proposes constrained Normalized Subsequence Matching (cNSM). By introducing flexible constraints on amplitude scaling ($\alpha$) and vertical offset ($\beta$), the authors transform the unconstrained search into a bounded problem. These constraints not only make the search indexable but also ensure that returned matches are physically meaningful, avoiding "shape matches" that may have physically impossible scales in a real-world context.

Geometric constraints and the resulting KV-index mapping.

The KV-Index and Matching Algorithm

The core of the proposed framework is the KV-index, a key-value store optimized for sequential throughput. Unlike complex tree structures that often suffer from random I/O overhead, the KV-index maps ranges of mean values (Keys) to lists of contiguous window intervals (Values). This structure is designed to leverage the high sequential read speeds of modern SSDs and distributed storage systems like HBase.

The KV-match Algorithm

The matching process leverages mathematical lemmas to define filtering conditions based on the $\alpha$ and $\beta$ constraints. The algorithm operates in two primary phases:

  1. Index Probing: The query is segmented, and the algorithm fetches candidate intervals from the index that fall within the calculated mean-value bounds for each segment.
  2. Intersection Strategy: Unlike traditional "union" strategies used in tree-based methods, KV-match intersects candidate sets from multiple disjoint windows. A candidate is only retained if it satisfies the bounds across all segments, drastically reducing the number of expensive distance calculations required in the verification step.
The KV-match process: segmenting query Q and intersecting candidate intervals from the index.

To handle arbitrary query lengths, KV-match$_{DP}$ employs a dynamic programming approach to optimally segment a long query into variable-length windows (e.g., 25, 50, or 100 points) that maximize pruning power against pre-built indexes.

Experimental Evaluation

The framework was evaluated using the UCR Archive, the PAMAP (Physical Activity Monitoring) dataset, and synthetic datasets of up to one trillion points.

  • Performance: For RSM, KV-match is 10–100x faster than traditional R-tree methods. For NSM, it consistently outperforms the UCR Suite by effectively pruning the search space so that only a tiny fraction of the raw data needs to be accessed.
  • Scalability: In extreme tests on a trillion-point dataset, KV-match$_{DP}$ processed queries in approximately 2 minutes on an 8-node cluster—a task that would take hours or days using conventional methods.

Conclusion

KV-Match demonstrates that by introducing bounded constraints, the "un-indexable" problem of normalized subsequence matching can be solved with high efficiency. By prioritizing sequential I/O and an intersection-based pruning strategy, the framework provides a scalable solution for modern large-scale time series analysis. Future work includes extending the framework to support more complex distance measures like variable-length Dynamic Time Warping (DTW).

Summary updated

BibTeX
@inproceedings{wu2019kv,
  author = {Jiaye Wu and Peng Wang and Ningting Pan and Chen Wang and Wei Wang and Jianmin Wang},
  title = {{KV-Match: A Subsequence Matching Approach Supporting Normalization and Time Warping}},
  booktitle = {ICDE},
  year = {2019},
  doi = {10.1109/icde.2019.00082},
}
Figure