achieving spatial adaptivity while searching for approximate nearest neighbors

47
Achieving Spatial Adaptivity in Approximate Nearest Neighbor Search Jonathan Derryberry, Don Sheehy , Daniel Sleator, and Maverick Woo

Upload: don-sheehy

Post on 11-May-2015

241 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Achieving Spatial Adaptivity inApproximate Nearest Neighbor Search

Jonathan Derryberry, Don Sheehy, Daniel Sleator, and Maverick Woo

Page 2: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 3: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 4: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 5: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 6: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

p is a c-approximate nearest neighbor of q if

d(q, p) < c d(q, NN(q)).

Page 7: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

p is a c-approximate nearest neighbor of q if

d(q, p) < c d(q, NN(q)).

Goals

• O(log n) queries

Page 8: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

p is a c-approximate nearest neighbor of q if

d(q, p) < c d(q, NN(q)).

Goals

• O(log n) queries

• O(d3/2)-approximation

Page 9: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

p is a c-approximate nearest neighbor of q if

d(q, p) < c d(q, NN(q)).

Goals

• O(log n) queries

• O(d3/2)-approximation

• Spatially Adaptive

Page 10: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 11: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 12: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 13: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 14: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 15: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 16: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Dynamic Finger Property:Query time is O(log(δ(p, q)))• where p is the previous query result.• q is the current query.• δ(p,q) is the number of input points between p and q.

Page 17: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 18: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Finger search pretty well solved in 1D[pointer machine: Brodal et al],[RAM, Andersson & Thorup]

Page 19: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Finger search pretty well solved in 1D[pointer machine: Brodal et al],[RAM, Andersson & Thorup]

Skip lists work.

Page 20: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Previous Work in 2D

• Proximate Point Search [Demaine, Iacono, and Langerman, ’02/’04]

• Proximate Point Location [Iacono and Langerman ’03]

Page 21: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

This work.

• O(d3/2) ANN in Rd

• O(d2 lg(δ(p,q))) queries. (Finger Search!)

• O(dn) space.

• O(d2 n lg n) preprocessing time

Page 22: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

This work.

• O(d3/2) ANN in Rd

• O(d2 lg(δ(p,q))) queries. (Finger Search!)

• O(dn) space.

• O(d2 n lg n) preprocessing time

?

Page 23: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 24: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 25: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 26: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 27: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

8d |p-q|

Page 28: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

8d |p-q|

δ(p, q) = # of input points in this box.

Page 29: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 30: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 31: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 32: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 33: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

The placement of the origin

matters.

Page 34: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

A classic O(d3/2)-ANN Algorithm:[Bern93, Chan98, Liao01 et al]

Put the input points in your favorite 1-dimensional data structure, ordered by

the Z-order.

Construct d+1 of these data structures, such that all points inserted into the ith are shifted by

(i/d+1) x diameter in every coordinate.

For each query, search all d+1 data structures for a nearest neighbor in the shifted Z-order.

Return the one that is closest in Rd.

Page 35: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 36: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 37: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Lemma [Chan]: With at least d+1 shifts, at most 1 is “bad” for each dimension.

Page 38: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Lemma [Chan]: With at least d+1 shifts, at most 1 is “bad” for each dimension.

So x and NNx share a small QT cell.

Page 39: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Are we done?

Z-order reduces d-dimensions to 1-dimension.

It works for ANN.

Finger Search in 1-dimension is solved.

Page 40: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors
Page 41: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Making it work.

1. Use 2d+1 1D data structures that support finger search.

2. Run all 2d+1 searches in parallel.

3. Stop when d+1 are finished.

4. Return the best answer among the d+1 that finished.

5. Manually update the finger pointers in all 2d+1 structures.

Page 42: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

If q and NNq are in a small QT box relative to their distance then the approximation is good.

Page 43: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

If p and q are in a small QT box relative to their

distance then the runtime is good.

If q and NNq are in a small QT box relative to their distance then the approximation is good.

Page 44: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

If p and q are in a small QT box relative to their

distance then the runtime is good.

If q and NNq are in a small QT box relative to their distance then the approximation is good.

We apply the Chan Lemma twice.

• Since at most d are bad for p and q, we can stop after all but d finish and the runtime is good.

• Since d+1 are left over, at least one will be a good approximation.

Page 45: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Summary

A new data structure.

• O(d3/2) ANN in Rd

• O(d2 lg(δ(p,q))) queries. (Finger Search!)

• O(dn) space.

• O(d2 n lg n) preprocessing time

Page 46: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Thank you.

Page 47: Achieving Spatial Adaptivity while Searching for Approximate Nearest Neighbors

Thank you.

Questions?