y = knn(xtrain, xtest, t, kmax)
y = knn(xtrain, xtest, t, kmax) takes a matrix xtrain
of input vectors (one vector per row) with corresponding 1-of-N coded class
labels in the matrix t and uses the k-nearest-neighbour rule to
produce
a matrix y of classifications for a new input matrix xtest.
The nearest neighbours are determined using Euclidean distance.
The kth column of the matrix y contains the predicted class labels
(as an index 1..N, not as 1-of-N coding)
using k nearest neighbours, where k runs from 1 to kmax.
y = knn(xtrain, xtest, targets, 2);Puts in the first column of
y the classification of each vector in
xtest according to
the nearest neighbour rule. The second column of y contains the
classification of each vector according to the 2 nearest neighbour rule.
kmeansCopyright (c) Christopher M Bishop, Ian T Nabney (1996, 1997)