ldaPerfViaKnncLoo

LDA recognition rate via KNNC and LOO performance index

Contents

Syntax

Description

recogRate=ldaPerfViaKnncLoo(DS) return the leave-one-out recognition rate of KNNC on the dataset DS after dimension reduction using LDA (linear discriminant analysis)

recogRate=ldaPerfViaKnncLoo(DS, opt) uses LDA with the option opt:

The default value of option can be obtained by ldaPerfViaKnncLoo('defaultOpt').

recogRate=ldaPerfViaKnncLoo(DS, opt, 1) plots the recognition rates w.r.t. dimensions after LDA transformation.

Example

Using LDA over WINE dataset

opt=ldaPerfViaKnncLoo('defaultOpt');
opt.mode='approximate';
DS=prData('wine');
recogRate1=ldaPerfViaKnncLoo(DS, opt, 1);
		LOO recog. rate of KNNC using 1 dim = 168/178 = 94.382%
		LOO recog. rate of KNNC using 2 dim = 168/178 = 94.382%
		LOO recog. rate of KNNC using 3 dim = 168/178 = 94.382%
		LOO recog. rate of KNNC using 4 dim = 173/178 = 97.191%
		LOO recog. rate of KNNC using 5 dim = 174/178 = 97.7528%
		LOO recog. rate of KNNC using 6 dim = 175/178 = 98.3146%
		LOO recog. rate of KNNC using 7 dim = 172/178 = 96.6292%
		LOO recog. rate of KNNC using 8 dim = 173/178 = 97.191%
		LOO recog. rate of KNNC using 9 dim = 170/178 = 95.5056%
		LOO recog. rate of KNNC using 10 dim = 168/178 = 94.382%
		LOO recog. rate of KNNC using 11 dim = 159/178 = 89.3258%
		LOO recog. rate of KNNC using 12 dim = 143/178 = 80.3371%
		LOO recog. rate of KNNC using 13 dim = 137/178 = 76.9663%

Compare two mode of LDA performance evaluation via KNNC-LOO

opt=ldaPerfViaKnncLoo('defaultOpt');
opt.mode='approximate';
DS=prData('wine');
tic; recogRate1=ldaPerfViaKnncLoo(DS, opt); time1=toc;
opt.mode='exact';
tic; recogRate2=ldaPerfViaKnncLoo(DS, opt); time2=toc;
figure;
plot(1:length(recogRate1), 100*recogRate1, '.-', 1:length(recogRate2), 100*recogRate2, '.-'); grid on
xlabel('No. of projected features based on LDA');
ylabel('LOO recognition rates using KNNC (%)');
title('Without input normalization');
legend('mode=''approximate''', 'mode=''exact''', 'location', 'southwest');
fprintf('time for approximate mode=%g sec, time for exact mode=%g sec\n', time1, time2);
time for approximate mode=0.0429682 sec, time for exact mode=0.686778 sec

Effect of input normalization of LDA over WINE dataset (with both modes)

opt=ldaPerfViaKnncLoo('defaultOpt');
DS=prData('wine');
DS2=DS; DS2.input=inputNormalize(DS2.input);
opt.mode='approximate';
rr11=ldaPerfViaKnncLoo(DS, opt);
rr12=ldaPerfViaKnncLoo(DS2, opt);
opt.mode='exact';
rr21=ldaPerfViaKnncLoo(DS, opt);
rr22=ldaPerfViaKnncLoo(DS2, opt);
figure;
xVec=1:length(recogRate1);
plot(xVec, 100*rr11, '.-b', xVec, 100*rr12, '.-m'); grid on
hold on; plot(xVec, 100*rr21, '^-b', xVec, 100*rr22, '^-m'); hold off
xlabel('No. of projected features based on LDA');
ylabel('LOO recognition rates using KNNC (%)');
title('With both modes');
legend('approximate mode, w/o input normalization', 'approximate mode, w/ input normalization', 'exact mode, w/o input normalization', 'exact mode, w/ input normalization', 'location', 'southwest');

See Also

lda.


Top page   Next: ldaOnWAndB.m   Prev:lincEval.m