liveBook · Manning

Pruning criterion

As explained in Advanced Algorithms and Data Structures

A pruning criterion is a rule that compares a branch's possible distance with the current nearest-neighbor distance to decide whether to skip the branch.

A pruning criterion decides whether a branch can be skipped during approximate nearest-neighbor search. It compares the branch’s closest possible distance with the current nearest-neighbor distance, trading some accuracy for fewer visited branches and dataset points. section 10.4.3

Apply the criterion as follows:

  • Maintain the current nearest neighbor and its distance from the query point. section 10.4.3
  • Compute the smallest possible distance from the query point to the branch’s bounding envelope. section 10.4.3
  • With approximation error ε, where 0.0 ≤ ε ≤ 0.5, prune unless that possible distance is smaller than the current distance divided by 1+ε. section 10.4.3

For ordinary nearest-neighbor search, ε=0 gives the exact-style comparison. Increasing ε makes pruning more aggressive while guaranteeing that the returned neighbor is no farther than a factor of 1+ε from the true nearest neighbor. section 10.4.3

A missed true neighbor

With ε≈0.25, traversal can prune the branch containing the true neighbor when that neighbor lies outside the approximated query region, while returning a closer-visited candidate.

How Advanced Algorithms and Data Structures covers it

How deep it goes
Derives an epsilon-scaled threshold and accuracy guarantee, but does not provide implementation code.
Examples
Illustrates traversal that prunes the branch containing the true neighbor and compares spherical with rectangular envelopes.
What it assumes
Assumes nearest-neighbor distance, query points, branches, and bounding envelopes.
What you can do after
Apply it to trade nearest-neighbor accuracy for fewer visited branches using an explicit approximation-error parameter.
How it connects
Connects approximate nearest-neighbor search with bounding envelopes and early termination.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.