Approximate Nearest Neighbor for Curves: Simple, Efficient, and Deterministic

Arnold Filtser, Omrit Filtser, Matthew J. Katz

TL;DR

This paper introduces a novel, deterministic data structure for efficiently finding approximate nearest neighbors among polygonal curves. It achieves significant improvements in query time and storage space compared to prior methods, making it practical for real-world applications involving trajectory data.

What Problem Does This Paper Address?

The core problem addressed is Approximate Nearest Neighbor for Curves (ANNC). Imagine you have a large database of curves (like GPS trajectories, stock market fluctuations, or DNA sequences) and you want to quickly find a curve in the database that is "similar" to a given query curve. "Similar" is defined by distance metrics like the Discrete Fréchet Distance (DFD) or Dynamic Time Warping (DTW). The challenge is that exact nearest neighbor search is computationally very expensive, especially for long curves or high-dimensional data. Existing approximate methods often suffer from either exponential query times or infeasible storage requirements. This paper tackles the ANNC problem by aiming for a solution that is both simple to implement, deterministic, and offers significant improvements in query time and storage space. They also consider an "asymmetric" version where query curves are much shorter than database curves, a common scenario in practice.

Methods

The authors propose a bucketing method based on discretizing the space using a d-dimensional uniform grid. The key idea is to construct a relatively small set of "representative" curves that capture all possible queries within a certain distance.

Here's a breakdown of their approach:

  • Discretization and Representative Curves: They lay a grid over the d-dimensional space. For each input curve, they identify a set of representative curves that are "close" to it. These representatives are chosen from grid points.
  • Data Structure: A dictionary (implemented as a hash table or a prefix tree) stores these representative curves. For each representative curve, it stores a pointer to an actual curve from the input set that is close to it.
  • Query Algorithm: Given a query curve, they first "snap" its vertices to the nearest grid points. Then, they search for this "snapped" curve in their dictionary. If found, they return the associated input curve.
  • Deterministic Construction: To avoid the potential worst-case performance of randomized data structures like hash tables, they also describe a deterministic construction using a prefix tree.
  • Asymmetric Setting: For query curves shorter than database curves, they use a simplification technique. They first simplify the input curves to a length similar to the query curves, and then apply the same ANNC approach. This allows them to achieve query and storage bounds independent of the original curve length.
  • Distance Metrics: The methods are designed to work with Discrete Fréchet Distance (DFD) and the more general $l_p,2$-distance (which includes Dynamic Time Warping as a special case).

Datasets

Not discussed in the paper. The paper focuses on theoretical contributions and data structures, not empirical evaluation on specific datasets.

Key Insights and Ideas

  • The Power of Discretization: By discretizing the space with a grid, they can effectively represent a vast number of potential query curves with a much smaller set of representatives. This is crucial for achieving good space complexity.
  • Surprising Space Efficiency: While efficient query time is often the focus, the paper highlights that their method achieves a surprisingly good space bound, which they suggest might be optimal.
  • Deterministic ANNC is Achievable: The paper demonstrates that it's possible to achieve efficient ANNC without relying on randomization, which is important for guaranteed performance.
  • Simplification for Asymmetric Queries: The technique of simplifying longer input curves to match the length of shorter query curves is a clever way to handle the asymmetric scenario efficiently.
  • Unified Approach for $l_p,2$-distance: The framework is general enough to handle various distance metrics, including DFD and $l_p,2$-distances, by adapting the grid and counting arguments.

Key Results

The paper presents several theorems summarizing their findings. Here are some highlights for the ANNC problem under Discrete Fréchet Distance (DFD):

  • Symmetric ANNC (DFD):
    • Space: $n \cdot O(1)^{md}$
    • Query Time: $O(md)$
    • Preprocessing Time: $n \cdot O(1)^{md}$ (expected)
    • This is a significant improvement over previous methods, which had exponential query times or infeasible storage.
  • Asymmetric ANNC (DFD):
    • Space: $n \cdot O(1)^{kd}$ (where $k$ is query curve length)
    • Query Time: $O(kd)$
    • Preprocessing Time: $nm \cdot (O(d \log m) + O(1)^{kd})$ (expected)
    • The query and storage bounds are independent of the original input curve length $m$.

Similar results are also presented for the $l_p,2$-distance and Dynamic Time Warping (DTW), with slightly different exponents depending on the dimension $d$ and parameter $p$.

Limitations and Future Work

  • Dimension Dependence: While the paper mentions dimension reduction techniques, the bounds still depend on the dimension $d$. For very high-dimensional data, the exponents can become large.
  • Practical Performance: The paper focuses on theoretical bounds. The practical performance of their data structure compared to existing libraries would require empirical evaluation.
  • Dynamic Setting: The paper mentions that their approach can be adapted to dynamic settings (where curves are added or removed), but this is not detailed in the current work.
  • Further Optimizations: The authors suggest that further work could explore more sophisticated counting arguments to potentially improve the exponents in the bounds.

Summary updated

BibTeX
@inproceedings{filtser2020approximate,
  author = {Arnold Filtser and Omrit Filtser and Matthew J. Katz},
  title = {{Approximate Nearest Neighbor for Curves: Simple, Efficient, and Deterministic}},
  booktitle = {ICALP},
  year = {2020},
  doi = {10.4230/lipics.icalp.2020.48},
}
Figure