<s>
In	O
statistics	O
,	O
the	O
k-nearest	B-General_Concept
neighbors	I-General_Concept
algorithm	I-General_Concept
(	O
k-NN	B-General_Concept
)	O
is	O
a	O
non-parametric	B-General_Concept
supervised	B-General_Concept
learning	I-General_Concept
method	O
first	O
developed	O
by	O
Evelyn	O
Fix	O
and	O
Joseph	O
Hodges	O
in	O
1951	O
,	O
and	O
later	O
expanded	O
by	O
Thomas	O
Cover	O
.	O
</s>
<s>
It	O
is	O
used	O
for	O
classification	B-General_Concept
and	O
regression	O
.	O
</s>
<s>
In	O
both	O
cases	O
,	O
the	O
input	O
consists	O
of	O
the	O
k	O
closest	O
training	O
examples	O
in	O
a	O
data	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
The	O
output	O
depends	O
on	O
whether	O
k-NN	B-General_Concept
is	O
used	O
for	O
classification	B-General_Concept
or	O
regression	O
:	O
</s>
<s>
In	O
k-NN	B-General_Concept
classification	B-General_Concept
,	O
the	O
output	O
is	O
a	O
class	O
membership	O
.	O
</s>
<s>
An	O
object	O
is	O
classified	O
by	O
a	O
plurality	O
vote	O
of	O
its	O
neighbors	O
,	O
with	O
the	O
object	O
being	O
assigned	O
to	O
the	O
class	O
most	O
common	O
among	O
its	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
(	O
k	O
is	O
a	O
positive	O
integer	O
,	O
typically	O
small	O
)	O
.	O
</s>
<s>
If	O
k	O
=	O
1	O
,	O
then	O
the	O
object	O
is	O
simply	O
assigned	O
to	O
the	O
class	O
of	O
that	O
single	O
nearest	B-General_Concept
neighbor	I-General_Concept
.	O
</s>
<s>
In	O
k-NN	B-General_Concept
regression	O
,	O
the	O
output	O
is	O
the	O
property	O
value	O
for	O
the	O
object	O
.	O
</s>
<s>
This	O
value	O
is	O
the	O
average	O
of	O
the	O
values	O
of	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
.	O
</s>
<s>
If	O
k	O
=	O
1	O
,	O
then	O
the	O
output	O
is	O
simply	O
assigned	O
to	O
the	O
value	O
of	O
that	O
single	O
nearest	B-General_Concept
neighbor	I-General_Concept
.	O
</s>
<s>
k-NN	B-General_Concept
is	O
a	O
type	O
of	O
classification	B-General_Concept
where	O
the	O
function	O
is	O
only	O
approximated	O
locally	O
and	O
all	O
computation	O
is	O
deferred	O
until	O
function	O
evaluation	O
.	O
</s>
<s>
Since	O
this	O
algorithm	O
relies	O
on	O
distance	O
for	O
classification	B-General_Concept
,	O
if	O
the	O
features	O
represent	O
different	O
physical	O
units	O
or	O
come	O
in	O
vastly	O
different	O
scales	O
then	O
normalizing	O
the	O
training	O
data	O
can	O
improve	O
its	O
accuracy	O
dramatically	O
.	O
</s>
<s>
Both	O
for	O
classification	B-General_Concept
and	O
regression	O
,	O
a	O
useful	O
technique	O
can	O
be	O
to	O
assign	O
weights	O
to	O
the	O
contributions	O
of	O
the	O
neighbors	O
,	O
so	O
that	O
the	O
nearer	O
neighbors	O
contribute	O
more	O
to	O
the	O
average	O
than	O
the	O
more	O
distant	O
ones	O
.	O
</s>
<s>
The	O
neighbors	O
are	O
taken	O
from	O
a	O
set	O
of	O
objects	O
for	O
which	O
the	O
class	O
(	O
for	O
k-NN	B-General_Concept
classification	B-General_Concept
)	O
or	O
the	O
object	O
property	O
value	O
(	O
for	O
k-NN	B-General_Concept
regression	O
)	O
is	O
known	O
.	O
</s>
<s>
A	O
peculiarity	O
of	O
the	O
k-NN	B-General_Concept
algorithm	I-General_Concept
is	O
that	O
it	O
is	O
sensitive	O
to	O
the	O
local	O
structure	O
of	O
the	O
data	O
.	O
</s>
<s>
The	O
training	O
phase	O
of	O
the	O
algorithm	O
consists	O
only	O
of	O
storing	O
the	O
feature	B-Algorithm
vectors	I-Algorithm
and	O
class	O
labels	O
of	O
the	O
training	O
samples	O
.	O
</s>
<s>
In	O
the	O
classification	B-General_Concept
phase	O
,	O
k	O
is	O
a	O
user-defined	O
constant	O
,	O
and	O
an	O
unlabeled	O
vector	O
(	O
a	O
query	O
or	O
test	O
point	O
)	O
is	O
classified	O
by	O
assigning	O
the	O
label	O
which	O
is	O
most	O
frequent	O
among	O
the	O
k	O
training	O
samples	O
nearest	O
to	O
that	O
query	O
point	O
.	O
</s>
<s>
For	O
discrete	O
variables	O
,	O
such	O
as	O
for	O
text	O
classification	B-General_Concept
,	O
another	O
metric	O
can	O
be	O
used	O
,	O
such	O
as	O
the	O
overlap	O
metric	O
(	O
or	O
Hamming	O
distance	O
)	O
.	O
</s>
<s>
In	O
the	O
context	O
of	O
gene	O
expression	O
microarray	O
data	O
,	O
for	O
example	O
,	O
k-NN	B-General_Concept
has	O
been	O
employed	O
with	O
correlation	O
coefficients	O
,	O
such	O
as	O
Pearson	O
and	O
Spearman	O
,	O
as	O
a	O
metric	O
.	O
</s>
<s>
Often	O
,	O
the	O
classification	B-General_Concept
accuracy	O
of	O
k-NN	B-General_Concept
can	O
be	O
improved	O
significantly	O
if	O
the	O
distance	O
metric	O
is	O
learned	O
with	O
specialized	O
algorithms	O
such	O
as	O
Large	B-Algorithm
Margin	I-Algorithm
Nearest	I-Algorithm
Neighbor	I-Algorithm
or	O
Neighbourhood	B-General_Concept
components	I-General_Concept
analysis	I-General_Concept
.	O
</s>
<s>
A	O
drawback	O
of	O
the	O
basic	O
"	O
majority	O
voting	O
"	O
classification	B-General_Concept
occurs	O
when	O
the	O
class	O
distribution	O
is	O
skewed	O
.	O
</s>
<s>
That	O
is	O
,	O
examples	O
of	O
a	O
more	O
frequent	O
class	O
tend	O
to	O
dominate	O
the	O
prediction	O
of	O
the	O
new	O
example	O
,	O
because	O
they	O
tend	O
to	O
be	O
common	O
among	O
the	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
due	O
to	O
their	O
large	O
number	O
.	O
</s>
<s>
One	O
way	O
to	O
overcome	O
this	O
problem	O
is	O
to	O
weight	O
the	O
classification	B-General_Concept
,	O
taking	O
into	O
account	O
the	O
distance	O
from	O
the	O
test	O
point	O
to	O
each	O
of	O
its	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
.	O
</s>
<s>
For	O
example	O
,	O
in	O
a	O
self-organizing	B-Algorithm
map	I-Algorithm
(	O
SOM	O
)	O
,	O
each	O
node	O
is	O
a	O
representative	O
(	O
a	O
center	O
)	O
of	O
a	O
cluster	O
of	O
similar	O
points	O
,	O
regardless	O
of	O
their	O
density	O
in	O
the	O
original	O
training	O
data	O
.	O
</s>
<s>
K-NN	B-General_Concept
can	O
then	O
be	O
applied	O
to	O
the	O
SOM	O
.	O
</s>
<s>
The	O
best	O
choice	O
of	O
k	O
depends	O
upon	O
the	O
data	O
;	O
generally	O
,	O
larger	O
values	O
of	O
k	O
reduces	O
effect	O
of	O
the	O
noise	O
on	O
the	O
classification	B-General_Concept
,	O
but	O
make	O
boundaries	O
between	O
classes	O
less	O
distinct	O
.	O
</s>
<s>
A	O
good	O
k	O
can	O
be	O
selected	O
by	O
various	O
heuristic	B-Algorithm
techniques	O
(	O
see	O
hyperparameter	B-General_Concept
optimization	I-General_Concept
)	O
.	O
</s>
<s>
when	O
k	O
=	O
1	O
)	O
is	O
called	O
the	O
nearest	B-General_Concept
neighbor	I-General_Concept
algorithm	O
.	O
</s>
<s>
The	O
accuracy	O
of	O
the	O
k-NN	B-General_Concept
algorithm	I-General_Concept
can	O
be	O
severely	O
degraded	O
by	O
the	O
presence	O
of	O
noisy	O
or	O
irrelevant	O
features	O
,	O
or	O
if	O
the	O
feature	O
scales	O
are	O
not	O
consistent	B-General_Concept
with	O
their	O
importance	O
.	O
</s>
<s>
Much	O
research	O
effort	O
has	O
been	O
put	O
into	O
selecting	B-General_Concept
or	O
scaling	B-General_Concept
features	O
to	O
improve	O
classification	B-General_Concept
.	O
</s>
<s>
A	O
particularly	O
popular	O
approach	O
is	O
the	O
use	O
of	O
evolutionary	B-Algorithm
algorithms	I-Algorithm
to	O
optimize	O
feature	B-General_Concept
scaling	I-General_Concept
.	O
</s>
<s>
In	O
binary	O
(	O
two	O
class	O
)	O
classification	B-General_Concept
problems	O
,	O
it	O
is	O
helpful	O
to	O
choose	O
k	O
to	O
be	O
an	O
odd	O
number	O
as	O
this	O
avoids	O
tied	O
votes	O
.	O
</s>
<s>
The	O
most	O
intuitive	O
nearest	O
neighbour	O
type	O
classifier	B-General_Concept
is	O
the	O
one	O
nearest	O
neighbour	O
classifier	B-General_Concept
that	O
assigns	O
a	O
point	O
to	O
the	O
class	O
of	O
its	O
closest	O
neighbour	O
in	O
the	O
feature	O
space	O
,	O
that	O
is	O
.	O
</s>
<s>
As	O
the	O
size	O
of	O
training	O
data	B-General_Concept
set	I-General_Concept
approaches	O
infinity	O
,	O
the	O
one	O
nearest	O
neighbour	O
classifier	B-General_Concept
guarantees	O
an	O
error	O
rate	O
of	O
no	O
worse	O
than	O
twice	O
the	O
Bayes	O
error	O
rate	O
(	O
the	O
minimum	O
achievable	O
error	O
rate	O
given	O
the	O
distribution	O
of	O
the	O
data	O
)	O
.	O
</s>
<s>
The	O
-nearest	O
neighbour	O
classifier	B-General_Concept
can	O
be	O
viewed	O
as	O
assigning	O
the	O
nearest	O
neighbours	O
a	O
weight	O
and	O
all	O
others	O
weight	O
.	O
</s>
<s>
This	O
can	O
be	O
generalised	O
to	O
weighted	O
nearest	B-General_Concept
neighbour	I-General_Concept
classifiers	I-General_Concept
.	O
</s>
<s>
An	O
analogous	O
result	O
on	O
the	O
strong	O
consistency	O
of	O
weighted	O
nearest	B-General_Concept
neighbour	I-General_Concept
classifiers	I-General_Concept
also	O
holds	O
.	O
</s>
<s>
Let	O
denote	O
the	O
weighted	O
nearest	O
classifier	B-General_Concept
with	O
weights	O
.	O
</s>
<s>
With	O
optimal	O
weights	O
the	O
dominant	O
term	O
in	O
the	O
asymptotic	O
expansion	O
of	O
the	O
excess	B-General_Concept
risk	I-General_Concept
is	O
.	O
</s>
<s>
Similar	O
results	O
are	O
true	O
when	O
using	O
a	O
bagged	B-Algorithm
nearest	I-Algorithm
neighbour	I-Algorithm
classifier	I-Algorithm
.	O
</s>
<s>
k-NN	B-General_Concept
is	O
a	O
special	O
case	O
of	O
a	O
variable-bandwidth	B-General_Concept
,	I-General_Concept
kernel	I-General_Concept
density	I-General_Concept
"	I-General_Concept
balloon	I-General_Concept
"	I-General_Concept
estimator	I-General_Concept
with	O
a	O
uniform	O
kernel	O
.	O
</s>
<s>
Using	O
an	O
approximate	O
nearest	B-Algorithm
neighbor	I-Algorithm
search	I-Algorithm
algorithm	O
makes	O
k-NN	B-General_Concept
computationally	O
tractable	O
even	O
for	O
large	O
data	B-General_Concept
sets	I-General_Concept
.	O
</s>
<s>
Many	O
nearest	B-Algorithm
neighbor	I-Algorithm
search	I-Algorithm
algorithms	O
have	O
been	O
proposed	O
over	O
the	O
years	O
;	O
these	O
generally	O
seek	O
to	O
reduce	O
the	O
number	O
of	O
distance	O
evaluations	O
actually	O
performed	O
.	O
</s>
<s>
k-NN	B-General_Concept
has	O
some	O
strong	O
consistency	O
results	O
.	O
</s>
<s>
As	O
the	O
amount	O
of	O
data	O
approaches	O
infinity	O
,	O
the	O
two-class	O
k-NN	B-General_Concept
algorithm	I-General_Concept
is	O
guaranteed	O
to	O
yield	O
an	O
error	O
rate	O
no	O
worse	O
than	O
twice	O
the	O
Bayes	O
error	O
rate	O
(	O
the	O
minimum	O
achievable	O
error	O
rate	O
given	O
the	O
distribution	O
of	O
the	O
data	O
)	O
.	O
</s>
<s>
Various	O
improvements	O
to	O
the	O
k-NN	B-General_Concept
speed	O
are	O
possible	O
by	O
using	O
proximity	O
graphs	O
.	O
</s>
<s>
where	O
is	O
the	O
Bayes	O
error	O
rate	O
(	O
which	O
is	O
the	O
minimal	O
error	O
rate	O
possible	O
)	O
,	O
is	O
the	O
k-NN	B-General_Concept
error	O
rate	O
,	O
and	O
is	O
the	O
number	O
of	O
classes	O
in	O
the	O
problem	O
.	O
</s>
<s>
There	O
are	O
many	O
results	O
on	O
the	O
error	O
rate	O
of	O
the	O
nearest	B-General_Concept
neighbour	I-General_Concept
classifiers	I-General_Concept
.	O
</s>
<s>
The	O
-nearest	O
neighbour	O
classifier	B-General_Concept
is	O
strongly	O
(	O
that	O
is	O
for	O
any	O
joint	O
distribution	O
on	O
)	O
consistent	B-General_Concept
provided	O
diverges	O
and	O
converges	O
to	O
zero	O
as	O
.	O
</s>
<s>
Let	O
denote	O
the	O
nearest	O
neighbour	O
classifier	B-General_Concept
based	O
on	O
a	O
training	O
set	O
of	O
size	O
.	O
</s>
<s>
The	O
choice	O
offers	O
a	O
trade	O
off	O
between	O
the	O
two	O
terms	O
in	O
the	O
above	O
display	O
,	O
for	O
which	O
the	O
-nearest	O
neighbour	O
error	O
converges	O
to	O
the	O
Bayes	O
error	O
at	O
the	O
optimal	O
(	O
minimax	B-Algorithm
)	O
rate	O
.	O
</s>
<s>
The	O
K-nearest	B-General_Concept
neighbor	I-General_Concept
classification	B-General_Concept
performance	O
can	O
often	O
be	O
significantly	O
improved	O
through	O
(	O
supervised	B-General_Concept
)	O
metric	O
learning	O
.	O
</s>
<s>
Popular	O
algorithms	O
are	O
neighbourhood	B-General_Concept
components	I-General_Concept
analysis	I-General_Concept
and	O
large	B-Algorithm
margin	I-Algorithm
nearest	I-Algorithm
neighbor	I-Algorithm
.	O
</s>
<s>
Supervised	B-General_Concept
metric	O
learning	O
algorithms	O
use	O
the	O
label	O
information	O
to	O
learn	O
a	O
new	O
metric	O
or	O
pseudo-metric	O
.	O
</s>
<s>
Transforming	O
the	O
input	O
data	O
into	O
the	O
set	O
of	O
features	O
is	O
called	O
feature	B-Algorithm
extraction	I-Algorithm
.	O
</s>
<s>
Feature	B-Algorithm
extraction	I-Algorithm
is	O
performed	O
on	O
raw	O
data	O
prior	O
to	O
applying	O
k-NN	B-General_Concept
algorithm	I-General_Concept
on	O
the	O
transformed	O
data	O
in	O
feature	O
space	O
.	O
</s>
<s>
An	O
example	O
of	O
a	O
typical	O
computer	B-Application
vision	I-Application
computation	O
pipeline	O
for	O
face	O
recognition	O
using	O
k-NN	B-General_Concept
including	O
feature	B-Algorithm
extraction	I-Algorithm
and	O
dimension	B-Algorithm
reduction	I-Algorithm
pre-processing	O
steps	O
(	O
usually	O
implemented	O
with	O
OpenCV	B-Language
)	O
:	O
</s>
<s>
For	O
high-dimensional	O
data	O
(	O
e.g.	O
,	O
with	O
number	O
of	O
dimensions	O
more	O
than	O
10	O
)	O
dimension	B-Algorithm
reduction	I-Algorithm
is	O
usually	O
performed	O
prior	O
to	O
applying	O
the	O
k-NN	B-General_Concept
algorithm	I-General_Concept
in	O
order	O
to	O
avoid	O
the	O
effects	O
of	O
the	O
curse	B-Algorithm
of	I-Algorithm
dimensionality	I-Algorithm
.	O
</s>
<s>
The	O
curse	B-Algorithm
of	I-Algorithm
dimensionality	I-Algorithm
in	O
the	O
k-NN	B-General_Concept
context	O
basically	O
means	O
that	O
Euclidean	O
distance	O
is	O
unhelpful	O
in	O
high	O
dimensions	O
because	O
all	O
vectors	O
are	O
almost	O
equidistant	O
to	O
the	O
search	O
query	O
vector	O
(	O
imagine	O
multiple	O
points	O
lying	O
more	O
or	O
less	O
on	O
a	O
circle	O
with	O
the	O
query	O
point	O
at	O
the	O
center	O
;	O
the	O
distance	O
from	O
the	O
query	O
to	O
all	O
data	O
points	O
in	O
the	O
search	O
space	O
is	O
almost	O
the	O
same	O
)	O
.	O
</s>
<s>
Feature	B-Algorithm
extraction	I-Algorithm
and	O
dimension	B-Algorithm
reduction	I-Algorithm
can	O
be	O
combined	O
in	O
one	O
step	O
using	O
principal	B-Application
component	I-Application
analysis	I-Application
(	O
PCA	B-Application
)	O
,	O
linear	B-General_Concept
discriminant	I-General_Concept
analysis	I-General_Concept
(	O
LDA	O
)	O
,	O
or	O
canonical	O
correlation	O
analysis	O
(	O
CCA	O
)	O
techniques	O
as	O
a	O
pre-processing	O
step	O
,	O
followed	O
by	O
clustering	O
by	O
k-NN	B-General_Concept
on	O
feature	B-Algorithm
vectors	I-Algorithm
in	O
reduced-dimension	O
space	O
.	O
</s>
<s>
For	O
very-high-dimensional	O
datasets	B-General_Concept
(	O
e.g.	O
</s>
<s>
when	O
performing	O
a	O
similarity	O
search	O
on	O
live	O
video	O
streams	O
,	O
DNA	O
data	O
or	O
high-dimensional	O
time	O
series	O
)	O
running	O
a	O
fast	O
approximate	O
k-NN	B-General_Concept
search	O
using	O
locality	B-Algorithm
sensitive	I-Algorithm
hashing	I-Algorithm
,	O
"	O
random	O
projections	O
"	O
,	O
"	O
sketches	O
"	O
or	O
other	O
high-dimensional	O
similarity	O
search	O
techniques	O
from	O
the	O
VLDB	O
toolbox	O
might	O
be	O
the	O
only	O
feasible	O
option	O
.	O
</s>
<s>
Nearest	B-General_Concept
neighbor	I-General_Concept
rules	O
in	O
effect	O
implicitly	O
compute	O
the	O
decision	B-General_Concept
boundary	I-General_Concept
.	O
</s>
<s>
It	O
is	O
also	O
possible	O
to	O
compute	O
the	O
decision	B-General_Concept
boundary	I-General_Concept
explicitly	O
,	O
and	O
to	O
do	O
so	O
efficiently	O
,	O
so	O
that	O
the	O
computational	O
complexity	O
is	O
a	O
function	O
of	O
the	O
boundary	O
complexity	O
.	O
</s>
<s>
Data	B-General_Concept
reduction	I-General_Concept
is	O
one	O
of	O
the	O
most	O
important	O
problems	O
for	O
work	O
with	O
huge	O
data	B-General_Concept
sets	I-General_Concept
.	O
</s>
<s>
Usually	O
,	O
only	O
some	O
of	O
the	O
data	O
points	O
are	O
needed	O
for	O
accurate	O
classification	B-General_Concept
.	O
</s>
<s>
Separate	O
the	O
rest	O
of	O
the	O
data	O
into	O
two	O
sets	O
:	O
(	O
i	O
)	O
the	O
prototypes	O
that	O
are	O
used	O
for	O
the	O
classification	B-General_Concept
decisions	O
and	O
(	O
ii	O
)	O
the	O
absorbed	O
points	O
that	O
can	O
be	O
correctly	O
classified	O
by	O
k-NN	B-General_Concept
using	O
prototypes	O
.	O
</s>
<s>
Class	O
outliers	O
with	O
k-NN	B-General_Concept
produce	O
noise	O
.	O
</s>
<s>
Given	O
two	O
natural	O
numbers	O
,	O
k>r>0	O
,	O
a	O
training	O
example	O
is	O
called	O
a	O
(	O
k	O
,	O
r	O
)	O
NN	O
class-outlier	O
if	O
its	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
include	O
more	O
than	O
r	O
examples	O
of	O
other	O
classes	O
.	O
</s>
<s>
Condensed	O
nearest	B-General_Concept
neighbor	I-General_Concept
(	O
CNN	O
,	O
the	O
Hart	O
algorithm	O
)	O
is	O
an	O
algorithm	O
designed	O
to	O
reduce	O
the	O
data	B-General_Concept
set	I-General_Concept
for	O
k-NN	B-General_Concept
classification	B-General_Concept
.	O
</s>
<s>
It	O
selects	O
the	O
set	O
of	O
prototypes	O
U	O
from	O
the	O
training	O
data	O
,	O
such	O
that	O
1NN	O
with	O
U	O
can	O
classify	O
the	O
examples	O
almost	O
as	O
accurately	O
as	O
1NN	O
does	O
with	O
the	O
whole	O
data	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
Use	O
U	O
instead	O
of	O
X	O
for	O
classification	B-General_Concept
.	O
</s>
<s>
2	O
shows	O
the	O
1NN	O
classification	B-General_Concept
map	O
:	O
each	O
pixel	O
is	O
classified	O
by	O
1NN	O
using	O
all	O
the	O
data	O
.	O
</s>
<s>
3	O
shows	O
the	O
5NN	O
classification	B-General_Concept
map	O
.	O
</s>
<s>
White	O
areas	O
correspond	O
to	O
the	O
unclassified	O
regions	O
,	O
where	O
5NN	O
voting	O
is	O
tied	O
(	O
for	O
example	O
,	O
if	O
there	O
are	O
two	O
green	O
,	O
two	O
red	O
and	O
one	O
blue	O
points	O
among	O
5	O
nearest	B-General_Concept
neighbors	I-General_Concept
)	O
.	O
</s>
<s>
4	O
shows	O
the	O
reduced	O
data	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
The	O
crosses	O
are	O
the	O
class-outliers	O
selected	O
by	O
the	O
(	O
3	O
,	O
2	O
)	O
NN	O
rule	O
(	O
all	O
the	O
three	O
nearest	B-General_Concept
neighbors	I-General_Concept
of	O
these	O
instances	O
belong	O
to	O
other	O
classes	O
)	O
;	O
the	O
squares	O
are	O
the	O
prototypes	O
,	O
and	O
the	O
empty	O
circles	O
are	O
the	O
absorbed	O
points	O
.	O
</s>
<s>
5	O
shows	O
that	O
the	O
1NN	O
classification	B-General_Concept
map	O
with	O
the	O
prototypes	O
is	O
very	O
similar	O
to	O
that	O
with	O
the	O
initial	O
data	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
In	O
k-NN	B-General_Concept
regression	O
,	O
the	O
k-NN	B-General_Concept
algorithm	I-General_Concept
is	O
used	O
for	O
estimating	O
continuous	O
variables	O
.	O
</s>
<s>
One	O
such	O
algorithm	O
uses	O
a	O
weighted	O
average	O
of	O
the	O
k	B-General_Concept
nearest	I-General_Concept
neighbors	I-General_Concept
,	O
weighted	O
by	O
the	O
inverse	O
of	O
their	O
distance	O
.	O
</s>
<s>
Find	O
a	O
heuristically	O
optimal	O
number	O
k	O
of	O
nearest	B-General_Concept
neighbors	I-General_Concept
,	O
based	O
on	O
RMSE	B-General_Concept
.	O
</s>
<s>
The	O
distance	O
to	O
the	O
kth	O
nearest	B-General_Concept
neighbor	I-General_Concept
can	O
also	O
be	O
seen	O
as	O
a	O
local	O
density	O
estimate	O
and	O
thus	O
is	O
also	O
a	O
popular	O
outlier	O
score	O
in	O
anomaly	B-Algorithm
detection	I-Algorithm
.	O
</s>
<s>
The	O
larger	O
the	O
distance	O
to	O
the	O
k-NN	B-General_Concept
,	O
the	O
lower	O
the	O
local	O
density	O
,	O
the	O
more	O
likely	O
the	O
query	O
point	O
is	O
an	O
outlier	O
.	O
</s>
<s>
Although	O
quite	O
simple	O
,	O
this	O
outlier	O
model	O
,	O
along	O
with	O
another	O
classic	O
data	O
mining	O
method	O
,	O
local	B-Algorithm
outlier	I-Algorithm
factor	I-Algorithm
,	O
works	O
quite	O
well	O
also	O
in	O
comparison	O
to	O
more	O
recent	O
and	O
more	O
complex	O
approaches	O
,	O
according	O
to	O
a	O
large	O
scale	O
experimental	O
analysis	O
.	O
</s>
<s>
A	O
confusion	B-General_Concept
matrix	I-General_Concept
or	O
"	O
matching	B-General_Concept
matrix	I-General_Concept
"	O
is	O
often	O
used	O
as	O
a	O
tool	O
to	O
validate	O
the	O
accuracy	O
of	O
k-NN	B-General_Concept
classification	B-General_Concept
.	O
</s>
<s>
More	O
robust	O
statistical	O
methods	O
such	O
as	O
likelihood-ratio	B-General_Concept
test	I-General_Concept
can	O
also	O
be	O
applied	O
.	O
</s>
