Abstract
Given a user dataset $U$ and an object dataset $I$, a kNN join query in high-dimensional space returns the $k$ nearest neighbors of each object in dataset $U$ from the object dataset $I$. The kNN join is a basic and necessary operation in many applications, such as databases, data mining, computer vision, multi-media, machine learning, recommendation systems, and many more. In the real world, datasets frequently update dynamically as objects are added or removed. In this paper, we propose novel methods of continuous kNN join over dynamic high-dimensional data. We firstly propose the HDR+ Tree which supports more efficient insertion, deletion, and batch update. Further observed that the existing methods rely on globally correlated datasets for effective dimensionality reduction, we then propose the HDR Forest. It clusters the dataset and constructs multiple HDR Trees to capture local correlations among the data. As a result, our HDR Forest is able to process non-globally correlated dataset efficiently. Two novel optimisations are applied to the proposed HDR Forest, including the precomputation of the PCA states of data items and pruning-based kNN recomputation during item deletion. For the completeness of the work, we also present the proof of computing distances in reduced dimensions of PCA in HDR Tree. Extensive experiments on real-world datasets show that the proposed methods and optimisations outperform the baseline algorithms of naive RkNN join and HDR Tree.
Introduction: The Challenge of Dynamic High-Dimensional Data
A k-Nearest Neighbor (kNN) join is a fundamental yet computationally expensive operation: for every point in a "user" dataset, the system must identify its $k$ closest matches in an "item" dataset. This operation powers critical technologies including recommendation engines, image retrieval systems, and anomaly detection.
However, two major hurdles complicate kNN joins in real-world scenarios:
- The Curse of Dimensionality: In high-dimensional spaces (e.g., 128D image features), traditional indexing structures often fail, leading to significant performance degradation.
- Dynamic Data Streams: Real-world datasets are rarely static. Items are constantly added or removed—such as in a sliding window of social media updates. Most existing algorithms struggle with these updates, often requiring costly full recomputations.
Previous solutions, such as the HDR Tree, utilized Principal Component Analysis (PCA) for dimensionality reduction. However, these methods assumed global correlation across the entire dataset. In practice, data is often "patchy," meaning a single global PCA model fails to capture the distinct features of localized data clusters.
Methodology: From HDR+ Tree to HDR Forest
To address these limitations, this research introduces a hierarchical approach to indexing and searching dynamic data.
HDR+ Tree: Incremental Optimization
The HDR+ Tree enhances the standard HDR Tree by implementing Lazy Updates and Batch Updates. Rather than updating the index for every individual arrival, the system marks affected nodes as "dirty." Mathematical recomputations are deferred until a query actually traverses that specific path, significantly reducing overhead in high-velocity data streams.
HDR Forest: Capturing Local Correlations
The flagship contribution of this work is the HDR Forest. Instead of a single global tree, the data is partitioned into clusters, each represented by its own local HDR Tree. Each local tree employs its own PCA matrix, allowing the system to capture local correlations that a global model would overlook. This localized approach enables more effective "pruning" (skipping large portions of the dataset that mathematically cannot contain a match).
Key Optimizations
Beyond the structural improvements, two specific optimizations enhance the HDR Forest's performance:
- Precomputation of PCA States: By precalculating the PCA projections of data items, the system reduces the real-time computational burden during query processing.
- Pruning-based Recomputation via "Friend Users": Deleting an item is traditionally more complex than adding one, as the system must find replacements for lost neighbors. The authors introduce "Friend Users"—points located within the same leaf node. By using the distances of these "friends" to establish mathematical bounds, the algorithm can ignore the vast majority of the dataset during deletion updates.
Experimental Evaluation
The proposed methods were evaluated using the NUS-WIDE Image Dataset, featuring 269,648 Flickr images represented by 128-dimensional vectors. Testing covered varying dimensions (32 to 500) and different sliding window sizes.
Key Results
- Insertion Efficiency: The HDR Forest demonstrated a consistent 12% speed improvement over the standard HDR Tree during item additions.
- Deletion Performance: The optimized HDR Forest (HDR) significantly outperformed competitors, requiring less than 50% of the time* taken by other methods during item deletions.
- Scalability: As dimensionality increased (up to 160D), the performance gap between the HDR Forest and baseline models widened, confirming its effectiveness against the "curse of dimensionality."
Conclusion
The HDR Forest represents a significant advancement in processing kNN joins for dynamic, high-dimensional data. By shifting from global to local dimensionality reduction and leveraging lazy updates, it achieves substantial performance gains.
While highly effective for exact kNN joins, future research could explore adapting this logic for approximate kNN joins, which offer further speedups for applications where perfect precision is not required. Additionally, scaling the HDR Forest to distributed environments (e.g., Spark or Flink) remains a vital next step for handling petabyte-scale datasets.
Summary updated