Abstract
Clustering sequences of varying lengths, such as DNA strands, shape boundaries, or consumer transactions, typically requires data normalization that can lead to information loss or aliasing. This paper introduces a robust framework that maps variable-length sequences into a Hidden Markov Model (HMM) parameter space. By performing eigenvector decomposition on an affinity matrix derived from these parameters, the algorithm achieves accurate clustering and automatically identifies the optimal number of clusters ($k$) without prior user specification.
Introduction
Most traditional clustering algorithms, including k-means and Support Vector Machines (SVMs), require input data to be represented as fixed-length feature vectors. In real-world applications, however, data often arrives in "ragged" sequences of different lengths. The standard workaround—normalizing data via sampling or interpolation—often degrades the signal. Furthermore, many existing methods require the number of clusters to be pre-defined, which is impractical when the underlying structure of the data is unknown. This paper proposes a method to cluster these sequences directly while allowing the data itself to reveal the correct number of groups.
Methodology
The proposed framework follows a four-step pipeline designed to transform variable-length data into a structured similarity space:
- HMM Parameter Mapping: Instead of comparing sequences directly, a Hidden Markov Model (HMM) is fitted to each individual sequence. This transforms a variable-length sequence into a fixed set of HMM parameters (transition and emission probabilities) that capture the underlying dynamics.
- Affinity Matrix Construction: An affinity matrix $A$ is computed where each entry $a_{ij}$ represents the mutual "fitness" between sequence $i$ and the HMM trained on sequence $j$. High mutual fitness indicates high similarity.
- Eigenvector Decomposition: The affinity matrix is decomposed into its eigenvalues and eigenvectors. The authors posit that the number of largest eigenvalues needed to span the similarity space is $k-1$, where $k$ is the number of clusters.
- Automated Cluster Selection: A validity score is used to partition the clusters. By evaluating the local maxima of this score, the algorithm automatically determines the optimal number of clusters.
Experimental Results
The method was evaluated using several synthetic scenarios to test its robustness and accuracy:
- Language Discrimination: The model successfully separated sequences of numbers spelled in English from those in Portuguese. The HMMs captured the intrinsic ordering dynamics of each language's character sequences.
- Pattern Matching and Optimal $k$ Detection: In experiments with eight random-length sequences partitioned into four distinct patterns, the algorithm's validity score peaked exactly at $k=4$, matching the ground truth.
- Robustness to Length: The experiments confirmed that the method accurately detects similarities even when sequence lengths differ significantly (e.g., one sequence being twice as long as another), proving that normalization is unnecessary.
Key Insights
- Fitness as Distance: By using the probability $P(s_i | f_j)$, the method bypasses the need for uniform sequence lengths or identical coordinate systems, provided the sequences share a common state space.
- Subspace Partitioning: Projecting the affinity matrix onto successive subspaces allows the algorithm to "split" the data into an increasing number of clusters until the validity score is maximized.
Conclusion
This research demonstrates that HMM parameter mapping combined with spectral decomposition provides a powerful tool for sequence analysis. While the current work focuses on discrete label sequences, future directions include extending the method to continuous HMMs for real-valued data and optimizing the computational cost of fitting models for every sequence in large-scale datasets.
Summary updated