Feature Selection Package - Algorithms - Classifiers - k-NN
Description
k-nearest neighbor (k-NN) is a method of classification that classifies an object based on the attributes and training samples already known. The object is classified by a majority vote of its neighbors, given the attributes most common of its k nearest neighbors.
Usage
Method Signature:
function [acc] = knnPrediction( trainX, trainY, testX, testY, k)

Output:
  acc: the accuracy of the classifier at 1 nearest neighbor.

Input:
  trainX: training data, each row is an instance.
  trainY: training data, each column is a class.
  testX: testing data, each row is an instance.
  testY: testing data, each column is a class.
  k: neighbor size.
Code Example
% Using wine.mat, a sample data set found in the same directory as
% knnPrediction.m.
knnPrediction(X,Y,X,Y,1)
Paper
BibTex entry for:

Output-Sensitive Algorithms for Computing Nearest-Neighbour Decision Boundaries
@article{1059748,
    author = {Bremner, David and Demaine, Erik and Erickson, Jeff and Iacono, John and Langerman, Stefan and Morin, Pat and Toussaint, Godfried},
   title = {Output-Sensitive Algorithms for Computing Nearest-Neighbour Decision Boundaries},
   journal = {Discrete Comput. Geom.},
   volume = {33},
   number = {4},
   year = {2005},
   issn = {0179-5376},
   pages = {593--604},
   doi = {http://dx.doi.org/10.1007/s00454-004-1152-0},
   publisher = {Springer-Verlag New York, Inc.},
   address = {Secaucus, NJ, USA},
}