0001 function targetA=rank2gbellParam(rank, compModelNum, targetScore, plotOpt)
0002 
0003 
0004 
0005 if nargin<1, selfdemo; return; end
0006 if nargin<3, targetScore=0.9; end
0007 if nargin<4, plotOpt=0; end
0008 
0009 defA=0.05; defB=0.5; defC=0;    
0010 
0011 rankRatio=rank/compModelNum;
0012 minRankRatio=min(rankRatio);
0013 maxRankRatio=max(rankRatio);
0014 a=linspace(eps, maxRankRatio, 100);
0015 if eps>=maxRankRatio
0016     targetA=defA;        
0017     return;
0018 end
0019 for i=1:length(a)
0020     score=gbellmf(rankRatio, [a(i), defB, defC]);
0021     meanScore(i)=mean(score);
0022 end
0023 
0024 targetA=interp1(meanScore, a, targetScore);
0025 
0026 if isnan(targetA)    
0027     targetA=defA;
0028 
0029 
0030 
0031 
0032 
0033 
0034 
0035 end
0036 
0037 if plotOpt
0038     subplot(2,1,1);
0039     plot(a, meanScore, '.-');
0040     line(targetA, targetScore, 'color', 'r', 'marker', 'o');
0041     [ranks, rankCount]=elementCount(rank);
0042     title(sprintf('ranks=%s, rankCount=%s, compModelNum=%d', mat2str(ranks), mat2str(rankCount), compModelNum));
0043     xlabel('Value of parameter "a"'); ylabel('Average score');
0044     grid on
0045     subplot(2,1,2);
0046     score=gbellmf(rankRatio, [targetA, defB, defC]);
0047     hist(score, 0.05:0.1:0.95);
0048     [a, b]=elementCount(score);
0049     xlabel('Score'); ylabel('Count'); title(sprintf('Score histogram (score=%s)', mat2str(fliplr(a*100), 3)));
0050 
0051 end
0052 
0053 
0054 function selfdemo
0055 rank=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 0 0 1 0 2 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 2 1 0 2 0 0 3 0 0 2 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 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