MATLAB File Help: prtClassKnn
prtClassKnn
  prtClassKnn  K-nearest neighbors classifier
 
     CLASSIFIER = prtClassKnn returns a K-nearest neighbors classifier
 
     CLASSIFIER = prtClassKnn(PROPERTY1, VALUE1, ...) constructs a
     prtClassKnn object CLASSIFIER with properties as specified by
     PROPERTY/VALUE pairs.
 
     A prtClassKnn object inherits all properties from the abstract class
     prtClass. In addition is has the following properties:
 
     k                  - The number of neigbors to be considered
     distanceFunction   - The function to be used to compute the
                          distance from samples to cluster centers. 
                          It must be a function handle of the form:
                          @(x1,x2)distFun(x1,x2). Most prtDistance*
                          functions will work.
 
     For information on the  K-nearest neighbors classifier algorithm, please
     refer to the following URL:
 
     http://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm    
 
     A prtClassKnn object inherits the TRAIN, RUN, CROSSVALIDATE and
     KFOLDS methods from prtAction. It also inherits the PLOT method
     from prtClass.
 
     Example:
 
      TestDataSet = prtDataGenUnimodal;      % Create some test and 
      TrainingDataSet = prtDataGenUnimodal;  % training data
      classifier = prtClassKnn;           % Create a classifier
      classifier = classifier.train(TrainingDataSet);    % Train
      classified = run(classifier, TestDataSet);         % Test
      classifier.plot;
See also
Class Details
Superclasses prtClass
Sealed false
Construct on load false
Constructor Summary
prtClassKnn K-nearest neighbors classifier 
Property Summary
dataSet The training prtDataSet, only stored if verboseStorage is true.  
dataSetSummary Structure that summarizes prtDataSet. 
distanceFunction Function handle to compute distance 
internalDecider Optional prtDecider object for making decisions 
isCrossValidateValid True 
isNativeMary true 
isSupervised True 
isTrained Indicates if prtAction object has been trained. 
k The number of neighbors to consider in the voting 
name K-Nearest Neighbor 
nameAbbreviation KNN  
showProgressBar  
twoClassParadigm Whether the classifier retures one output (binary) or two outputs (m-ary) when there are only two unique class labels 
userData User specified data 
verboseStorage Specifies whether or not to store the training prtDataset. 
Method Summary
  crossValidate Cross validate prtAction using prtDataSet and cross validation keys. 
  get get the object properties 
  kfolds Perform K-folds cross-validation of prtAction 
  optimize Optimize action parameter by exhaustive function maximization. 
  plot Plot the output confidence of a prtClass object 
  run Run a prtAction object on a prtDataSet object. 
  set set the object properties 
  train Train a prtAction object using training a prtDataSet object.