comparison examples/SMALL_test_coherence2.m @ 174:dc2f0fa21310 danieleb

multiple trials with error bars
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Thu, 17 Nov 2011 11:16:15 +0000
parents 68fb71aa5339
children 0d7a81655ef2
comparison
equal deleted inserted replaced
173:7426503fc4d1 174:dc2f0fa21310
69 end 69 end
70 end 70 end
71 71
72 %% Evaluate coherence and snr of representation for the various methods 72 %% Evaluate coherence and snr of representation for the various methods
73 sr = zeros(size(SMALL.DL)); %signal to noise ratio 73 sr = zeros(size(SMALL.DL)); %signal to noise ratio
74 mu = zeros(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs,blockSize); %cumulative coherence 74 mu = zeros(nTrials,nInitDicts,nCorrLevels,nDecorrAlgs,blockSize); %cumulative coherence
75 dic(size(SMALL.DL)) = dictionary; %initialise dictionary objects 75 dic(size(SMALL.DL)) = dictionary; %initialise dictionary objects
76 for iTrial=1:nTrials 76 for iTrial=1:nTrials
77 for iInitDicts=1:nInitDicts 77 for iInitDicts=1:nInitDicts
78 for iCorrLevels=1:nCorrLevels 78 for iCorrLevels=1:nCorrLevels
79 for iDecorrAlgs=1:nDecorrAlgs 79 for iDecorrAlgs=1:nDecorrAlgs
94 end 94 end
95 95
96 %% Plot results 96 %% Plot results
97 minMu = sqrt((dictSize-blockSize)/(blockSize*(dictSize-1))); %lowe bound on coherence 97 minMu = sqrt((dictSize-blockSize)/(blockSize*(dictSize-1))); %lowe bound on coherence
98 initDictsNames = {'Data','Gabor'}; 98 initDictsNames = {'Data','Gabor'};
99 dicDecorrNames = {'Iter. Proj. + Rotation','INK-SVD','Iter. Proj.'}; 99 dicDecorrNames = {'IPR','INK-SVD','IP'};
100 lineStyles = {'ks-','kd-','ko-'}; 100 lineStyles = {'k.-','r*-','b+-'};
101 for iInitDict=1:nInitDicts 101 for iInitDict=1:nInitDicts
102 figure, hold on, grid on 102 figure, hold on, grid on
103 title([initDictsNames{iInitDict} ' Initialisation']); 103 title([initDictsNames{iInitDict} ' Initialisation']);
104 plot([1 1],[0 25],'k-'); 104 plot([1 1],[0 25],'k-');
105 for iDecorrAlgs=1:nDecorrAlgs 105 for iDecorrAlgs=1:nDecorrAlgs
106 plot(mu(1,iInitDict,:,iDecorrAlgs,1),sr(1,iInitDict,:,iDecorrAlgs),... 106 coherenceLevels = squeeze(mean(mu(:,iInitDict,:,iDecorrAlgs,1),1));
107 lineStyles{iDecorrAlgs}); 107 meanSNRs = squeeze(mean(sr(:,iInitDict,:,iDecorrAlgs),1));
108 stdSNRs = squeeze(std(sr(:,iInitDict,:,iDecorrAlgs),0,1));
109 errorbar(coherenceLevels,meanSNRs,stdSNRs,lineStyles{iDecorrAlgs});
108 end 110 end
109 plot([minMu minMu],[0 25],'k--') 111 plot([minMu minMu],[0 25],'k--')
110 112
111 set(gca,'YLim',[0 25],'XLim',[0 1.4]); 113 set(gca,'YLim',[0 25],'XLim',[0 1.4]);
112 legend([{'\mu_{max}'},dicDecorrNames,{'\mu_{min}'}]); 114 legend([{'\mu_{max}'},dicDecorrNames,{'\mu_{min}'}]);