lau_knn_crosserr
USE:
[missrate,gen,stdevGE] = lau_knn_crosserr(X,y,cvsets,k)
DESCRIPTION:
Computes the performance of a k-nearest neighbor classifier by n-fold crossvalidation. The global misclassification rate, the confusion
matrix and its standard deviation are computed. At each fold, a disjoint fraction of data (1/cvsets) are predicted while
the remaining fraction (1-1/cvsets) is used as prototypes. The confusion matrix
is computed for each fold and summed up to form the global confusion matrix,
gen.
ARGUMENTS:
X must be
an mxp matrix (p>=1) and y an m rows vector. y corresponds to the class variable while X with the feature
vector. Values of y must be integers from 1 to Nc (number of classes).
k is the
number of neighbors on which decision is taken.
cvsets is the number of folds in crossvalidation.
VALUES:
gen is the crossvalidated
confusion matrix, missrate is the misclassification
rate (1-sum of diagonal elements of gen/sum of all
elements of gen) while stdevGE
is the standard deviation matrix associated with the gen
matrix.
EXAMPLES:
//load the
iris data set. There are 3 classes and 50 samples in each
> irisdata
//use the
iris data set to evaluate the 5-fold crosvalidated
performance of a 10-nearest neighbor classifier
>[missrate,gen,stdevGE] = lau_knn_crosserr(X,y,5,10)
COMMENTS:
Created by Laurentiu Adi
Tarca. Revised 10.07.2003
This help
was created on 12.03.2004