Home > utility > rankPlot.m

rankPlot

PURPOSE ^

rankPlot: Top-n rank plot

SYNOPSIS ^

function rrVec=rankPlot(rankVec, n)

DESCRIPTION ^

 rankPlot: Top-n rank plot
    Usage: recogRateVec = rankPlot(rankVec, n)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function rrVec=rankPlot(rankVec, n)
0002 % rankPlot: Top-n rank plot
0003 %    Usage: recogRateVec = rankPlot(rankVec, n)
0004 
0005 %    Roger Jang, 20081118
0006 
0007 if nargin<1, selfdemo; return; end
0008 if nargin<2, n=10; end
0009 
0010 rankLen=length(rankVec);
0011 rankVec(~isfinite(rankVec))=[];
0012 rankIndex=1:n;
0013 rankVec(rankVec>n)=[];
0014 rankCount=hist(rankVec, rankIndex);
0015 cumulatedRankCount=cumsum(rankCount);
0016 subplot(2,1,1);
0017 rrVec=cumulatedRankCount/rankLen*100;
0018 plot(rankIndex, rrVec, 'o-');
0019 set(gca, 'ylim', [0 100]);
0020 xlabel('Rank'); ylabel('Cumulated percentage (%)'); title('Top-n recognition rates');
0021 subplot(2,1,2);
0022 stem(rankIndex, rankCount);
0023 xlabel('Rank'); ylabel('Count'); title('Rank counts');
0024 
0025 % ====== Self demo
0026 function selfdemo
0027 rankVec=[1 1 1 3 2 1 8 1 inf 1 2 1 5 1 1 inf 1 1 3 1 1 12 1 1 1 inf 1 1 1 1 1 inf 15 14 1 1 1 1 1 2 1 23 1 1 7 1 7 8 1 1 1 9 1 1 4 5 1];
0028 n=10;
0029 rrVec=rankPlot(rankVec, n);

Generated on Tue 01-Jun-2010 09:50:34 by m2html © 2003