<s>
Nearest	B-Algorithm
neighbor	I-Algorithm
search	I-Algorithm
(	O
NNS	O
)	O
,	O
as	O
a	O
form	O
of	O
proximity	B-Algorithm
search	I-Algorithm
,	O
is	O
the	O
optimization	O
problem	O
of	O
finding	O
the	O
point	O
in	O
a	O
given	O
set	O
that	O
is	O
closest	O
(	O
or	O
most	O
similar	O
)	O
to	O
a	O
given	O
point	O
.	O
</s>
<s>
3	O
of	O
The	B-General_Concept
Art	I-General_Concept
of	I-General_Concept
Computer	I-General_Concept
Programming	I-General_Concept
(	O
1973	O
)	O
called	O
it	O
the	O
post-office	B-Algorithm
problem	I-Algorithm
,	O
referring	O
to	O
an	O
application	O
of	O
assigning	O
to	O
a	O
residence	O
the	O
nearest	O
post	O
office	O
.	O
</s>
<s>
A	O
direct	O
generalization	O
of	O
this	O
problem	O
is	O
a	O
k-NN	B-General_Concept
search	O
,	O
where	O
we	O
need	O
to	O
find	O
the	O
k	O
closest	O
points	O
.	O
</s>
<s>
One	O
example	O
is	O
asymmetric	O
Bregman	B-Algorithm
divergence	I-Algorithm
,	O
for	O
which	O
the	O
triangle	O
inequality	O
does	O
not	O
hold	O
.	O
</s>
<s>
The	O
nearest	B-Algorithm
neighbour	I-Algorithm
search	I-Algorithm
problem	O
arises	O
in	O
numerous	O
fields	O
of	O
application	O
,	O
including	O
:	O
</s>
<s>
Recommendation	B-Application
systems	I-Application
,	O
e.g.	O
</s>
<s>
The	O
informal	O
observation	O
usually	O
referred	O
to	O
as	O
the	O
curse	B-Algorithm
of	I-Algorithm
dimensionality	I-Algorithm
states	O
that	O
there	O
is	O
no	O
general-purpose	O
exact	O
solution	O
for	O
NNS	O
in	O
high-dimensional	O
Euclidean	O
space	O
using	O
polynomial	O
preprocessing	O
and	O
polylogarithmic	O
search	O
time	O
.	O
</s>
<s>
This	O
algorithm	O
,	O
sometimes	O
referred	O
to	O
as	O
the	O
naive	O
approach	O
,	O
has	O
a	O
running	O
time	O
of	O
O(dN )	O
,	O
where	O
N	O
is	O
the	O
cardinality	B-Application
of	O
S	O
and	O
d	O
is	O
the	O
dimensionality	O
of	O
S	O
.	O
There	O
are	O
no	O
search	O
data	O
structures	O
to	O
maintain	O
,	O
so	O
the	O
linear	O
search	O
has	O
no	O
space	O
complexity	O
beyond	O
the	O
storage	O
of	O
the	O
database	O
.	O
</s>
<s>
Naive	O
search	O
can	O
,	O
on	O
average	O
,	O
outperform	O
space	B-Algorithm
partitioning	I-Algorithm
approaches	O
on	O
higher	O
dimensional	O
spaces	O
.	O
</s>
<s>
Since	O
the	O
1970s	O
,	O
the	O
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
methodology	O
has	O
been	O
applied	O
to	O
the	O
problem	O
.	O
</s>
<s>
Several	O
space-partitioning	B-Algorithm
methods	O
have	O
been	O
developed	O
for	O
solving	O
the	O
NNS	O
problem	O
.	O
</s>
<s>
Perhaps	O
the	O
simplest	O
is	O
the	O
k-d	B-Data_Structure
tree	I-Data_Structure
,	O
which	O
iteratively	O
bisects	O
the	O
search	O
space	O
into	O
two	O
regions	O
containing	O
half	O
of	O
the	O
points	O
of	O
the	O
parent	O
region	O
.	O
</s>
<s>
Alternatively	O
the	O
R-tree	B-Library
data	O
structure	O
was	O
designed	O
to	O
support	O
nearest	B-Algorithm
neighbor	I-Algorithm
search	I-Algorithm
in	O
dynamic	O
context	O
,	O
as	O
it	O
has	O
efficient	O
algorithms	O
for	O
insertions	O
and	O
deletions	O
such	O
as	O
the	O
R*	B-Data_Structure
tree	I-Data_Structure
.	O
</s>
<s>
R-trees	B-Library
can	O
yield	O
nearest	B-General_Concept
neighbors	I-General_Concept
not	O
only	O
for	O
Euclidean	O
distance	O
,	O
but	O
can	O
also	O
be	O
used	O
with	O
other	O
distances	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
general	O
metric	O
space	O
,	O
the	O
branch-and-bound	B-Algorithm
approach	O
is	O
known	O
as	O
the	O
metric	B-Data_Structure
tree	I-Data_Structure
approach	O
.	O
</s>
<s>
Particular	O
examples	O
include	O
vp-tree	B-Data_Structure
and	O
BK-tree	B-Data_Structure
methods	O
.	O
</s>
<s>
An	O
approximate	O
nearest	B-Algorithm
neighbor	I-Algorithm
search	I-Algorithm
algorithm	O
is	O
allowed	O
to	O
return	O
points	O
whose	O
distance	O
from	O
the	O
query	O
is	O
at	O
most	O
times	O
the	O
distance	O
from	O
the	O
query	O
to	O
its	O
nearest	O
points	O
.	O
</s>
<s>
The	O
appeal	O
of	O
this	O
approach	O
is	O
that	O
,	O
in	O
many	O
cases	O
,	O
an	O
approximate	O
nearest	B-General_Concept
neighbor	I-General_Concept
is	O
almost	O
as	O
good	O
as	O
the	O
exact	O
one	O
.	O
</s>
<s>
Proximity	O
graph	O
methods	O
(	O
such	O
as	O
HNSW	O
)	O
are	O
considered	O
the	O
current	O
state-of-the-art	O
for	O
the	O
approximate	O
nearest	B-General_Concept
neighbors	I-General_Concept
search	O
.	O
</s>
<s>
The	O
search	O
for	O
the	O
nearest	B-General_Concept
neighbors	I-General_Concept
to	O
a	O
query	O
q	O
in	O
the	O
set	O
S	O
takes	O
the	O
form	O
of	O
searching	O
for	O
the	O
vertex	O
in	O
the	O
graph	O
.	O
</s>
<s>
Locality	B-Algorithm
sensitive	I-Algorithm
hashing	I-Algorithm
(	O
LSH	O
)	O
is	O
a	O
technique	O
for	O
grouping	O
points	O
in	O
space	O
into	O
'	O
buckets	O
 '	O
based	O
on	O
some	O
distance	O
metric	O
operating	O
on	O
the	O
points	O
.	O
</s>
<s>
The	O
cover	B-Data_Structure
tree	I-Data_Structure
has	O
a	O
theoretical	O
bound	O
that	O
is	O
based	O
on	O
the	O
dataset	O
's	O
doubling	O
constant	O
.	O
</s>
<s>
In	O
practice	O
this	O
technique	O
has	O
an	O
average	O
search	O
time	O
of	O
O(1 )	O
or	O
O(K )	O
for	O
the	O
k-nearest	B-General_Concept
neighbor	I-General_Concept
problem	I-General_Concept
when	O
applied	O
to	O
real	O
world	O
stereo	O
vision	O
data	O
.	O
</s>
<s>
The	O
final	O
candidates	O
are	O
determined	O
in	O
a	O
second	O
stage	O
using	O
the	O
uncompressed	B-General_Concept
data	O
from	O
the	O
disk	O
for	O
distance	O
calculation	O
.	O
</s>
<s>
The	O
optimal	O
compression	O
technique	O
in	O
multidimensional	O
spaces	O
is	O
Vector	B-Algorithm
Quantization	I-Algorithm
(	O
VQ	O
)	O
,	O
implemented	O
through	O
clustering	O
.	O
</s>
<s>
There	O
are	O
numerous	O
variants	O
of	O
the	O
NNS	O
problem	O
and	O
the	O
two	O
most	O
well-known	O
are	O
the	O
k-nearest	B-General_Concept
neighbor	I-General_Concept
search	O
and	O
the	O
ε-approximate	B-Algorithm
nearest	I-Algorithm
neighbor	I-Algorithm
search	I-Algorithm
.	O
</s>
<s>
k-nearest	B-General_Concept
neighbor	I-General_Concept
search	O
identifies	O
the	O
top	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
to	O
the	O
query	O
.	O
</s>
<s>
This	O
technique	O
is	O
commonly	O
used	O
in	O
predictive	B-General_Concept
analytics	I-General_Concept
to	O
estimate	O
or	O
classify	O
a	O
point	O
based	O
on	O
the	O
consensus	O
of	O
its	O
neighbors	O
.	O
</s>
<s>
k-nearest	B-General_Concept
neighbor	I-General_Concept
graphs	O
are	O
graphs	O
in	O
which	O
every	O
point	O
is	O
connected	O
to	O
its	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
.	O
</s>
<s>
In	O
some	O
applications	O
it	O
may	O
be	O
acceptable	O
to	O
retrieve	O
a	O
"	O
good	O
guess	O
"	O
of	O
the	O
nearest	B-General_Concept
neighbor	I-General_Concept
.	O
</s>
<s>
In	O
those	O
cases	O
,	O
we	O
can	O
use	O
an	O
algorithm	O
which	O
does	O
n't	O
guarantee	O
to	O
return	O
the	O
actual	O
nearest	B-General_Concept
neighbor	I-General_Concept
in	O
every	O
case	O
,	O
in	O
return	O
for	O
improved	O
speed	O
or	O
memory	O
savings	O
.	O
</s>
<s>
Often	O
such	O
an	O
algorithm	O
will	O
find	O
the	O
nearest	B-General_Concept
neighbor	I-General_Concept
in	O
a	O
majority	O
of	O
cases	O
,	O
but	O
this	O
depends	O
strongly	O
on	O
the	O
dataset	O
being	O
queried	O
.	O
</s>
<s>
Algorithms	O
that	O
support	O
the	O
approximate	O
nearest	B-Algorithm
neighbor	I-Algorithm
search	I-Algorithm
include	O
locality-sensitive	B-Algorithm
hashing	I-Algorithm
,	O
best	B-Algorithm
bin	I-Algorithm
first	I-Algorithm
and	O
balanced	O
box-decomposition	O
tree	O
based	O
search	O
.	O
</s>
<s>
Nearest	B-General_Concept
neighbor	I-General_Concept
distance	O
ratio	O
does	O
not	O
apply	O
the	O
threshold	O
on	O
the	O
direct	O
distance	O
from	O
the	O
original	O
point	O
to	O
the	O
challenger	O
neighbor	O
but	O
on	O
a	O
ratio	O
of	O
it	O
depending	O
on	O
the	O
distance	O
to	O
the	O
previous	O
neighbor	O
.	O
</s>
<s>
It	O
is	O
used	O
in	O
CBIR	B-Application
to	O
retrieve	O
pictures	O
through	O
a	O
"	O
query	O
by	O
example	O
"	O
using	O
the	O
similarity	O
between	O
local	O
features	O
.	O
</s>
<s>
More	O
generally	O
it	O
is	O
involved	O
in	O
several	O
matching	B-Language
problems	O
.	O
</s>
<s>
Fixed-radius	B-Algorithm
near	I-Algorithm
neighbors	I-Algorithm
is	O
the	O
problem	O
where	O
one	O
wants	O
to	O
efficiently	O
find	O
all	O
points	O
given	O
in	O
Euclidean	O
space	O
within	O
a	O
given	O
fixed	O
distance	O
from	O
a	O
specified	O
point	O
.	O
</s>
<s>
entropy	O
estimation	O
)	O
,	O
we	O
may	O
have	O
N	O
data-points	O
and	O
wish	O
to	O
know	O
which	O
is	O
the	O
nearest	B-General_Concept
neighbor	I-General_Concept
for	O
every	O
one	O
of	O
those	O
N	O
points	O
.	O
</s>
