Introduction
In machine learning, data is often structured as unordered trees—such as XML files, HTML documents, or chemical compounds like glycans. In these structures, parent-child relationships are crucial, but the left-to-right order of siblings is not. To compare these trees, researchers rely on "kernels," which are functions that measure similarity.
A popular choice is the subpath kernel, which evaluates vertical paths within the tree to capture hierarchical information. However, previous algorithms for computing this kernel were either theoretically slow ($O(n \log n)$ or $O(n^2)$) or lacked a guaranteed linear-time bound. Furthermore, using these kernels in the "prediction phase" of a Support Vector Machine (SVM) was painfully slow because computational complexity scaled linearly with the number of support vectors.
This paper introduces a theoretically guaranteed linear-time algorithm for computing the subpath kernel for unordered trees. By adapting string-processing techniques to tree structures, the authors achieve massive speedups in both kernel evaluation and model prediction, making complex tree-based machine learning practical for large-scale datasets.
Methodology: Adapting String Algorithms to Trees
The authors bridge the gap between tree processing and efficient string algorithms through three main innovations:
- Linear-time ESA for Trees: The authors propose the first algorithm to construct an Enhanced Suffix Array (ESA) for a tree in $O(|T|)$ time. They adapt the "skew algorithm" (originally for strings) to handle tree suffixes, defined as paths from any node back to the root.
- Bottom-up ESA Traversal: To compute the kernel, they simulate a bottom-up traversal of a Suffix Tree using only the ESA. This allows them to count common subpaths between two trees in linear time relative to their total size.
- Fast Prediction Algorithm: Usually, predicting the label of a new tree requires comparing it to every "support vector" (important training examples). The authors devise a method to concatenate all support vectors into a "master tree" ESA. This makes the prediction time independent of the number of support vectors, scaling only with the size of the input tree.
The "aha moment" of this approach is treating every path from a node to the root as a "suffix." This allows the researchers to use powerful string-matching data structures on hierarchical tree data. While Suffix Trees are theoretically fast, they are notorious memory hogs. By using the ESA, the authors achieve the same speed with a much smaller memory footprint.
Datasets and Key Results
The researchers evaluated their approach using artificial datasets to test scalability, alongside three real-world benchmarks: an XML dataset (3,183 trees) and two Glycan datasets (Cystic with 160 trees, and Leukemia with 480 trees).
- Speed and Scalability: The proposed linear-time algorithm consistently outperformed previous approaches, including the "multi-key quicksort" method and standard tree kernels. On artificial datasets, execution time scaled perfectly linearly as tree size increased, confirming the theoretical $O(|T|)$ complexity.
- Prediction Efficiency: By using the "master tree" structure, the "Fast Prediction" method decoupled prediction speed from the size of the training set. Even as the number of support vectors grew into the thousands, the time to classify a new tree remained constant.
- Accuracy: The subpath kernel remained highly competitive with, and often slightly outperformed, other state-of-the-art tree kernels. This proves that the significant speed gains did not come at the cost of predictive performance.
Limitations and Future Work
While the prediction algorithm is practically linear, its theoretical worst-case complexity is $O(|T|^2)$ for certain highly specific tree shapes, though the authors note this is rarely encountered in real data. Additionally, this specific optimization is tailored for unordered trees; applying it to ordered trees by ignoring order might lose relevant sibling-order information (e.g., in linguistics).
Future work could involve integrating this fast kernel into the training framework of SVMs (such as cutting-plane methods) to speed up the entire model lifecycle, rather than just the evaluation and prediction phases.
Summary updated