KNN_LNK(1)

NAME
knn_lnk - K Nearest Neighbor Classifier

SYNOPSIS
Program for training and testing a K Nearest Neighbor classifier.

knn_lnk [ -k n ] [ -cvtest ] [ -classifier_options ]

EXAMPLE
knn_lnk -train -create -pathdata $LNKHOME/data/class \
-finput vowel.train -fdescribe vowel.defaults \
-fparam knn.param -npatterns 338

knn_lnk -k 3 -pathdata $LNKHOME/data/class -finput vowel.eval \
-fdescribe vowel.defaults -fparam knn.param -npatterns 166

DESCRIPTION
In training, stores all patterns presented. In testing, finds the k stored patterns nearest to the test pattern. The class selected for the test pattern is the one that occurs the most among the k nearest neighbors. Ties are broken at random.

OPTIONS
-- Prints a list of all flags and arguments.

-k n
    n is the number of nearest neighbors to use in testing.

-cvtest
    Do leave-one-out cross validation on knn model given. In leave-one-out cross validation, the k+1 nearest neighbors are found for each stored pattern. The nearest neighbor, which should be the pattern itself, is left out and the class is obtained from the remaining k neighbors.

-classifier_options
    knn_lnk accepts the general classifier arguments described on the classifier(1) manual page. Certain arguments are not used by the program, and so are not available.

    Unavailable arguments from general list:

    -adjust_test_priors -test_priors_list -test_uniform_priors
        Because knn_lnk does nearest neighbor classification, there are no outputs to scale for adjusting the priors during testing.

    -log_outputs
        knn_lnk does not currently store outputs in the error file.

    -random
        This flag only has an effect when adjust_train_priors is set.

REFERENCE
Yuchun Lee, Classifiers: Adaptive Modules in Pattern Recognition Systems, Bachelor's and Master's Thesis, Massachusetts Institute of Technology, Department of Electrical Engineering and Computer Science, Cambridge, MA, May 1989. Pages 79-80.

SEE ALSO
classifier(1), knn2c(1), knn_feat_sel(1), knn_plot_bound(1)

HISTORY
First written 26 May 1992 by Linda Kukolich

BUGS
Send bug reports to Linda Kukolich (kukolich@sst.ll.mit.edu)