1% TEST_FSS test of fss.m 2 3% Copyright (C) 2009,2010,2016 by Alois Schloegl <alois.schloegl@gmail.com> 4% This function is part of the NaN-toolbox 5% http://pub.ist.ac.at/~schloegl/matlab/NaN/ 6 7% This program is free software; you can redistribute it and/or 8% modify it under the terms of the GNU General Public License 9% as published by the Free Software Foundation; either version 3 10% of the License, or (at your option) any later version. 11% 12% This program is distributed in the hope that it will be useful, 13% but WITHOUT ANY WARRANTY; without even the implied warranty of 14% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15% GNU General Public License for more details. 16% 17% You should have received a copy of the GNU General Public License 18% along with this program; if not, write to the Free Software 19% Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 20 21if 1, 22clear 23if ~exist('ue6.mat','file') 24 if strncmp(computer,'PCWIN',5) 25 fprintf(1,'Download http://pub.ist.ac.at/~schloegl/LV/SMBS/UE6/ue6.mat and save in local directory %s\nPress any key to continue ...\n',pwd); 26 pause; 27 else 28 system('wget http://pub.ist.ac.at/~schloegl/LV/SMBS/UE6/ue6.mat'); 29 end; 30end 31load ue6; 32 33N = 10; % select N highest ranked features 34[ix,score] = fss(data, C, N); 35end; 36 37classifier= {'REG','MDA','MD2','QDA','QDA2','LD2','LD3','LD4','LD5','LD6','NBC','aNBC','WienerHopf','LDA/GSVD','MDA/GSVD', 'LDA/sparse','MDA/sparse', 'PLA', 'LMS','LDA/DELETION','MDA/DELETION','NBC/DELETION','RDA/DELETION','REG/DELETION','RDA','GDBC','SVM','PSVM','SVM11','SVM:LIN4','SVM:LIN0','SVM:LIN1','SVM:LIN2','SVM:LIN3'};%,'RBF' 38 39%% compute cross-validated result; 40for k=1:N 41 [R1{k},CC1{k}]=xval(data(:,ix(1:k)),C); 42end; 43for k=1:length(classifier), 44 fprintf(1,'%i:\t%s\n',k,classifier{k}); 45 [R2{k},CC2{k}]=xval(data(:,ix(1:5)),C,classifier{k}); 46end; 47 48fprintf(1,'#\tFeature\tN\tACC [%%]\tKappa+-se\t I [bit]\n'); 49R=R1; 50for k=1:length(R); 51 n(k)=sum(R{k}.data(:)); 52 ACC(k)=R{k}.ACC; 53 KAP(k)=R{k}.kappa; 54 KAP_Se(k)=R{k}.kappa_se; 55 MI(k)=R{k}.MI; 56 57 fprintf(1,'%3i:\t%4i\t%i\t%5.2f\t%5.2f+-%5.2f\t%4.2f\n',k,ix(k),n(k),ACC(k),KAP(k),KAP_Se(k),MI(k)); 58end 59R=R2; 60for k=1:length(R); 61 n(k)=sum(R{k}.data(:)); 62 ACC(k)=R{k}.ACC; 63 KAP(k)=R{k}.kappa; 64 KAP_Se(k)=R{k}.kappa_se; 65 MI(k)=R{k}.MI; 66 67 fprintf(1,'%3i:\t%8s\t%i\t%5.2f\t%5.2f+-%5.2f\t%4.2f\n',k,classifier{k},n(k),ACC(k),KAP(k),KAP_Se(k),MI(k)); 68end 69 70 71%% display 72plot(ACC*100,'x'); 73set(gca,'YLim',[0,100]) 74ylabel('Accuracy [%]') 75title('selection of N out of 2540 features') 76 77 78