annotate tests/pointset_test/plotLSHresults.m @ 507:e7fd50483311

Free bits of the datum constructed in audioDB::query. We're not quite safe: error calls between allocation of some of these bits and pieces and their use will cause failure... but not freeing things here is definitely wrong.
author mas01cr
date Tue, 13 Jan 2009 21:37:10 +0000
parents 63ae0dfc1767
children 397e94f6db44
rev   line source
mas01mc@291 1 function plotLSHresults(filename, w, kk, useLog)
mas01mc@291 2 if nargin<4, useLog=0;end
mas01mc@291 3 if nargin<3, kk=1;end
mas01mc@291 4
mas01mc@291 5 R = load(filename,'ascii'); % Assume 10 radii queries x 10 radii result summaries
mas01mc@291 6
mas01mc@291 7 for k=1:10
mas01mc@291 8 RR(k,:)=mean(R(k:10:end,:))./100; % Convert to Probability
mas01mc@291 9 end
mas01mc@291 10
mas01mc@291 11 c=['r' 'g' 'b' 'c' 'm' 'y' 'k'];
mas01mc@291 12
mas01mc@291 13 if(useLog)
mas01mc@291 14 logSym=' Log_{10} ';
mas01mc@291 15 else
mas01mc@291 16 logSym='';
mas01mc@291 17 end
mas01mc@291 18
mas01mc@291 19 figure
mas01mc@291 20 subplot(211)
mas01mc@291 21 hold on
mas01mc@291 22 radii=[0.1 0.2 0.4 0.5 0.7 0.9 1 2 5 10];
mas01mc@291 23 for k=1:10
mas01mc@291 24 if(useLog)
mas01mc@291 25 semilogx(radii, kk*log10(lshP(w,radii./radii(k))),[num2str(c(mod(k,length(c))+1)) '-+'],'lineWidth',2)
mas01mc@291 26 else
mas01mc@291 27 plot(radii,lshP(w,radii./radii(k)).^kk,[num2str(c(mod(k,length(c))+1)) '-+'],'lineWidth',2)
mas01mc@291 28 end
mas01mc@291 29 end
mas01mc@291 30 if(useLog)
mas01mc@291 31 axis([radii(1) radii(end) -kk 0])
mas01mc@291 32 else
mas01mc@291 33 axis([0 10 0 1])
mas01mc@291 34 end
mas01mc@291 35 grid on
mas01mc@291 36 legend([{"r=.1"},{"r=.2"},{"r=.4"},{"r=.5"},{"r=.7"},{"r=.9"},{"r=1"},{"r=2"},{"r=5"},{"r=10"}])
mas01mc@291 37 title(['Estimated Probability for 10 LSH radii searches: w=' num2str(w) ' , k=' num2str(kk)])
mas01mc@291 38 xlabel('Radius')
mas01mc@291 39 ylabel([logSym 'Probability'])
mas01mc@291 40
mas01mc@291 41
mas01mc@291 42 subplot(212)
mas01mc@291 43 hold on
mas01mc@291 44 for k=1:10
mas01mc@291 45 if(useLog)
mas01mc@291 46 semilogx(radii,kk*log(RR(k,:)),[num2str(c(mod(k,length(c))+1)) '-+'],'lineWidth',2)
mas01mc@291 47 else
mas01mc@291 48 plot(radii,RR(k,:).^kk,[num2str(c(mod(k,length(c))+1)) '-+'],'lineWidth',2)
mas01mc@291 49 end
mas01mc@291 50 end
mas01mc@291 51 if(useLog)
mas01mc@291 52 axis([radii(1) radii(end) -kk 0])
mas01mc@291 53 else
mas01mc@291 54 axis([0 10 0 1])
mas01mc@291 55 endif
mas01mc@291 56 grid on
mas01mc@291 57 legend([{"r=.1"},{"r=.2"},{"r=.4"},{"r=.5"},{"r=.7"},{"r=.9"},{"r=1"},{"r=2"},{"r=5"},{"r=10"}])
mas01mc@291 58 title(['Observed Probability for 10 LSH radii searches: w=' num2str(w) ' , k=' num2str(kk)])
mas01mc@291 59 xlabel('Radius')
mas01mc@291 60 ylabel([logSym 'Probability'])
mas01mc@291 61