Changeset 138 for proiecte/PPPP/ica/nnClassFn.m
- Timestamp:
- Jan 14, 2010, 4:14:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
proiecte/PPPP/ica/nnClassFn.m
r94 r138 17 17 18 18 19 function [testPerf ,rankmat,rank] = nnclassFn(train,test,trainClass,answer);19 function [testPerf] = nnclassFn(train,test,trainClass,answer); 20 20 21 21 numTest = size(test,2); … … 29 29 [Sdist,nearest] = sort(dists'); %cols of Sdist are distances in ascend order 30 30 %1st row of nearest is index of 1st closest training example 31 32 disp(Sdist) 31 33 32 34 %Create vector with nearest example, and vector with class label. … … 43 45 44 46 %get rank = %correct in top N: 45 cumtestPerf=0;46 for i = 1:3 47 rankmat(:,i) = trainClass(nearest(i,:)');48 correcti = find( (rankmat(:,i) - answer == 0));49 cumtestPerf = cumtestPerf + size(correcti,1) / size(answer,1);50 rank(i) = cumtestPerf;51 end47 %cumtestPerf=0; 48 %for i = 1 49 % rankmat(:,i) = trainClass(nearest(i,:)'); 50 % correcti = find( (rankmat(:,i) - answer == 0)); 51 % cumtestPerf = cumtestPerf + size(correcti,1) / size(answer,1); 52 % rank(i) = cumtestPerf; 53 %end 52 54 53 55 %For FERET test, want probeID (answer), then rank, then matched ID no.,
Note: See TracChangeset
for help on using the changeset viewer.