Introduction
Measuring similarity is a fundamental task in time series analysis, with applications ranging from medical diagnostics (ECG signals) to gesture recognition (sign language). Traditionally, the Longest Common Subsequence (LCS) has been the standard metric. LCS identifies the length of the longest sequence of symbols appearing in both series in the same relative order. However, LCS is inherently "lossy" as it focuses exclusively on the single longest match, ignoring the wealth of information contained in all other shared subsequences.
This paper introduces All Common Subsequences (ACS), a novel similarity measure that counts every shared subsequence. By shifting from a "winner-takes-all" approach to a holistic count, ACS provides a more granular and robust similarity metric.
The ACS Framework
The transition from LCS to ACS presents two primary challenges: computational complexity and the handling of continuous, real-valued data.
1. Efficient Counting via Dynamic Programming
Counting all common subsequences of a sequence of length $n$ is potentially exponential ($2^n$). To address this, the authors propose the calACS algorithm, a Dynamic Programming (DP) approach that computes the total count in $O(nm)$ time. The recurrence relation doubles the count when elements match ($A_i = B_j$) and sums previous counts while adjusting for overlaps when they do not.
2. Probabilistic Extension for Real-Valued Data
While LCS and ACS were originally designed for discrete symbols, real-world time series are typically continuous. Standard adaptations often use "hard thresholds" for equality, which can be brittle. This work proposes a "soft" approach using probabilistic metric spaces. Instead of binary equality, the algorithm utilizes the probability $Prob(A_i = B_j)$, estimated via normalized distance measures. Specifically, Normalized Contextual Probability (NCM) is used to apply ACS to multidimensional, real-valued data.
Experimental Evaluation
The ACS measure was evaluated using k-Nearest Neighbors (kNN) classification on several public datasets, including ECG heartbeats (ECG2c and ECG3c) and the multivariate Australian Sign Language (Auslan) dataset.
Stability Across Neighbors
A key finding is that ACS maintains high accuracy even as the number of neighbors ($k$) in kNN increases. In contrast, LCS-based methods often see a performance degradation as $k$ grows. This stability suggests that ACS captures a deeper structural similarity that remains consistent across a larger neighborhood.
As shown in Figure 3, on the ECG2c dataset, the ACS variant using NCM (acs_w_ncm) maintains a consistent 95% accuracy from $k=1$ to $k=19$. Meanwhile, the corresponding LCS variant (lcs_w_ncm) drops from 95% to 65% over the same range.
Performance on Complex Multivariate Data
On the full Auslan dataset, which involves complex multivariate sign language gestures, ACS combined with NCM demonstrated strong and stable performance.
Figure 4 illustrates that acs_w_ncm achieves 93-94% accuracy on the Auslan dataset, outperforming standard threshold-based LCS extensions and maintaining this performance even as $k$ increases.
Conclusion
All Common Subsequences (ACS) offers a more comprehensive measure of similarity than the traditional LCS by accounting for the "density" of shared patterns. Its computational efficiency and stability across varying neighborhood sizes make it a promising tool for time series classification and retrieval. Future work will focus on refining probability estimation methods for real-valued data and testing the algorithm on larger, more diverse datasets.
Summary updated