


KNN(1)                   USER COMMANDS                     KNN(1)



NAME
     knn - k nearest neighbour classifier for pattern recognition
     workbench

SYNOPSIS
     knn -l refpatterns
     knn (-t patterns|-T patterns|-r  patterns)  (-n  neighbours)
     (-a) (-s) (-f falrate) refpatterns

DESCRIPTION
     knn provides a general purpose k-nearest-neighbour  classif-
     ier  designed  to operate within the UCL pattern recognition
     workbench.   Pattern  vectors  are  supplied  in  two  files
     <pattern>.vec which contains the binary floating point data,
     and <pattern>.lab which contains the labels and offsets into
     the  .vec  file  for each pattern vector.  The format of the
     pattern files follows the UCL pattern recognition  workbench
     standard.   The program has three modes of operation: learn,
     test and recognise.  For each mode, the user must supply the
     basename of the two pattern vector files.

  LEARNING MODE
     In learning mode, the set of reference patterns is  used  to
     generate  a knn index <pattern>.knn which speeds up recogni-
     tion performance.

  TEST MODE
     In test mode, the set of  reference  patterns  and  the  knn
     index  are  used  to generate outputs for each vector in the
     test pattern vector files which are then compared  with  the
     supplied  labels. For switch '-t' performance statistics are
     printed, for switch '-T' statistics are saved into  the  PRW
     database /usr/prw/records.

     In the defualt case, the chosen class is  taken  by  a  vote
     amongst the closest 'k' reference patterns.  The '-a' switch
     may be employed for 2-class continuous problems, so that the
     output  label can be analysed as an 'activation' analgous to
     the mlpw program.  The activation is simply  the  proportion
     of marked labels in the top 'k' matches.

     With the -a option the statistics are based on the  location
     of  a  threshold that equalises the miss-rate and the false-
     alarm rate.  An option (-f falrate) allows the setting of  a
     specific false alarm rate. An option (-s) produces files for
     plotting the Receiver Operating Characteristic.

  RECOGNITION MODE
     In recognition mode, the set of reference patterns  and  the
     knn  index  are  used to generate outputs for each vector in
     the pattern vector files.  The input label  and  the  recog-
     nised  output  are  written  to the files <pattern>.gc.i and



PRW                     Last change: UCL                        1






KNN(1)                   USER COMMANDS                     KNN(1)



     <pattern>.gc.r respectively.  With 2 class continuous  prob-
     lems,  the  -a option, the recognised output is the 'activa-
     tion' of the classifier.

     Options:

     -I         Identify the program name and version.

     -l patterns
                Select learn mode.  Generates <pattern>.knn index
                to patterns.

     -t patterns
                Select test mode.  Print  statistics  of  perfor-
                mance  of  classifier  on supplied pattern vector
                files using reference patterns and  index.  Equal
                error based on frame percentages.

     -T patterns
                Select test mode.  Save statistics of performance
                of  classifier  on  supplied pattern vector files
                into PRW record database.

     -r patterns
                Select  recognise  mode.   Output   labels   into
                <pattern>.knn.i and <pattern>.knn.r.

     -nneighbours
                Select number of nearest neighbours to choose for
                vote.  Best if number is not a simple multiple of
                the number of pattern classes.  Default is 9.

     -a         Use the 'activation' of the classifier in testing
                and  recognition.  (2-class  continuous  problems
                only)

     -s         (Test  mode  only)   Produce   statistics   files
                <pattern>.rcx   (False-alarm  rate  as  threshold
                increases), <pattern>.rcy (Hit rate as  threshold
                increases)  for  plotting  ROC.  Implies 'activa-
                tion' mode.

     -ffalrate  (Test mode only) Produce  performance  statistics
                for  a  given  false-alarm  rate.   Default is to
                choose equal-error point).   Implies  'activation
                mode'.

FILES
     /usr/prw/records - PRW statistics records database

VERSION/AUTHOR
     2.0 - Mark Huckvale



PRW                     Last change: UCL                        2






KNN(1)                   USER COMMANDS                     KNN(1)



SOURCE
     /users/mark/sfs/man/../prw/knn.src/knn.c





















































PRW                     Last change: UCL                        3



