-Nearest neighbour algorithm [2,1] works
in the following way:
- Given an input matrix training
:
- For each of the
rows of input data matrix:
- Compute e.g. the Euclidean distance (of course other distance
can be used) to the
other rows:
- Set the class of row number
equal to the ``winning''
class of the
rows that lie closest (the
-Nearest Neighbours).
Given an input vector
whose class is unknown:
- Compute the distance to all rows of the training matrix
.
- Select the class of the input vector
equal to
the class of the row that it lies closest to.
Bjørn Kåre Alsberg
2006-04-06