Abstract
String classification is a fundamental task in bioinformatics and text mining. Traditional string kernels often suffer from local bias, diagonal dominance, and poor scalability. This paper introduces Random String Embeddings (RSE), a novel approach that leverages random features based on global alignment (Edit Distance) to capture long-range patterns while achieving linear computational complexity in both the number of samples and string length.
Introduction
String classification is vital for analyzing DNA, proteins, and text. However, existing string kernels face three major hurdles:
- Local Bias: Most kernels (like $k$-spectrum) focus on short, fixed-length substrings ($k$-mers), failing to capture global structural properties spanning the entire sequence.
- Diagonal Dominance: Summing over too many substructures can make a string overwhelmingly similar only to itself, leading to a kernel matrix that resembles an identity matrix and hinders generalization.
- Scalability: Computing a full kernel matrix typically requires $O(N^2)$ operations, creating a massive computational bottleneck for large datasets.
Random String Embeddings (RSE)
The authors propose Random String Embeddings (RSE) to overcome these limitations. Instead of implicitly mapping strings to a high-dimensional space, RSE explicitly embeds them into a low-dimensional vector space using Random Features.
The core idea is to define a kernel based on the Edit Distance (Levenshtein distance) between a data string and a set of $R$ "random strings" (anchors). A string $x$ is represented as a vector where each entry is the distance to an anchor $\omega_i$. This ensures the kernel is positive-definite and reduces training complexity to $O(N \cdot R \cdot L)$, where $L$ is the string length.
The paper explores four sampling strategies for these anchors:
- RSE(RF/RFD): Characters drawn uniformly or based on data frequency.
- RSE(SS/BSS): Randomly sampling actual substrings or blocks of substrings from the training data.
Experimental Evaluation
RSE was evaluated on nine benchmark datasets across protein analysis, DNA/RNA sequences, and image-as-string tasks.
Key Results
- Superior Accuracy: RSE significantly outperformed baselines like SSK and ASK. On protein datasets, RSE achieved 25% to 33% higher accuracy than traditional methods.
- Computational Efficiency: On the
superfamilydataset, RSE achieved top accuracy in just 3.7 seconds, while traditional kernels took hundreds of seconds. - Deep Learning Comparison: RSE often outperformed LSTMs and GRUs, especially on smaller datasets where deep learning models are prone to overfitting.
Insights and Scalability
The primary innovation of RSE is that global alignment captures structural information that $k$-mer counting misses. By using random features, the authors bypass the $O(N^2)$ requirement, allowing the method to scale linearly with both the number of strings ($N$) and their length ($L$).
Experimental results show that data-dependent sampling (SS and BSS) generally provides the best performance, as these anchors better represent the underlying data distribution. Empirical tests confirmed that RSE's runtime grows linearly, making it suitable for large-scale biological sequence analysis.
Conclusion
RSE provides a scalable and effective framework for string classification by moving beyond local substructure counting. Future work could extend this to other distance metrics or non-linear solvers to further push the boundaries of string analysis.
Summary updated