knncPlot_b
Plot the results of KNNC (k-nearest-neighbor classifier) after training
Contents
Syntax
- knncPlot(DS, knncPrm, mode)
Description
knncPlot(DS, knncPrm)
- DS: data set used for training (This is only used to obtain the range of the plot.)
- knncPrm: parameters of KNNC obtain from knncTrain
- mode: a string that specifies mode of plot
- 'distance': for plot of the distance function
- 'decBoundary': for plot of the decision boundary
Example
This example uses the Taiji dataset for classification:
[trainSet, testSet]=prData('3classes');
knncPrm=knncTrain(trainSet);
knncPrm.k=1;
Plot 2D distance function:
figure; knncPlot(trainSet, knncPrm, 'distance');
Error using knncPlot (line 128) Unknown mode! Error in knncPlot_b_help (line 27) figure; knncPlot(trainSet, knncPrm, 'distance');
Plot decision boundary:
figure; knncPlot(trainSet, knncPrm, 'decBoundary');