Abstract
Building $\epsilon$-neighbor graphs for massive datasets is a fundamental yet computationally expensive task in machine learning. This paper introduces a highly efficient approach that combines Locality Sensitive Hashing (LSH) with a specialized "Multiple Sorting Method" (MSM). By mapping high-dimensional vectors to bit strings and employing masked radix sorts, the proposed method achieves near-linear time complexity. Experimental results on a dataset of 1.6 million images demonstrate that MSM significantly outperforms traditional tree-based methods, providing a scalable solution for constructing neighborhood graphs in "big data" applications.
Introduction
Neighborhood graphs, where data points are connected to their closest peers, serve as the foundation for various algorithms, including manifold learning, spectral clustering, and semi-supervised learning. However, the construction of these graphs presents a significant computational challenge. A naive "all-pairs" approach requires $O(n^2)$ distance calculations, which becomes prohibitive for datasets with millions of points. While tree-based structures like KD-trees or Cover Trees offer improvements, their performance often degrades in high-dimensional spaces or fails to scale efficiently to massive datasets.
This paper addresses the problem of constructing $\epsilon$-neighbor graphs—graphs that connect all pairs of points within a fixed distance $\epsilon$. The authors propose a pipeline that transforms this geometric proximity problem into an efficient string-sorting task, enabling the processing of millions of points in a matter of hours.
Methodology
The proposed system utilizes a two-step process to identify neighbors efficiently:
- Vector-to-String Mapping (LSH): The algorithm first uses Cosine Locality Sensitive Hashing to project high-dimensional vectors into short bit strings. This mapping ensures that vectors close in the original space are likely to result in strings with a small Hamming distance.
- Multiple Sorting Method (MSM): The core innovation is the MSM, which identifies all pairs of strings differing by at most $d$ bits. Unlike standard LSH, which requires exact matches, MSM uses masked radix sorts. By "masking" specific bit positions and sorting the remaining bits, identical strings in the reduced space are grouped together, effectively finding "near-miss" pairs.
- Blockwise Masking: To prevent a combinatorial explosion in the number of sorting passes, the authors implement blockwise masking. This groups bits into blocks, drastically reducing the required number of iterations while maintaining the ability to detect neighbors.
Experimental Evaluation
The algorithm was evaluated using a massive dataset of 1.6 million small images (Torralba et al., 2008). These images were converted into 1024-dimensional grayscale vectors. The authors tested the MSM approach against various subset sizes to observe computational growth rates and compared its performance to state-of-the-art exact methods like Cover Trees.
Results and Discussion
The MSM approach demonstrated significant speedups over traditional methods. For the full 1.6 million image dataset, the algorithm completed the graph construction in approximately 2.09 hours, identifying 1.5 million edges. This performance is attributed to several key factors:
- The "Similar, Not Identical" Advantage: Standard LSH requires many independent hash tables (replicates) because it relies on neighbors colliding into the exact same bucket. By allowing for a Hamming distance $d > 0$, MSM enables neighbors to fall into similar buckets, which drastically reduces the number of replicates needed to maintain high accuracy.
- Output Sensitivity: The runtime of the algorithm is proportional to the number of actual neighbors found ($m$), making it exceptionally fast for sparse graphs.
- Accuracy: Despite being an approximate method, MSM can achieve a "missing edge ratio" as low as $1.0 \times 10^{-6}$, making it practically indistinguishable from exact methods for most machine learning tasks.
Conclusion
The Multiple Sorting Method provides a robust and scalable framework for neighborhood graph construction. By shifting the focus from individual point queries to batch "all-pairs" discovery, the authors achieve performance levels that make large-scale manifold learning feasible. Future work may involve the implementation of MSM on GPUs to leverage the parallel nature of radix sort and exploring non-random hashing techniques to further improve accuracy and efficiency.
Summary updated