Home > asr > rank2gbellParam.m

rank2gbellParam

PURPOSE ^

rank2gbellParam: Return the parameter "a" of a generalized bell function based on a vector of given ranks.

SYNOPSIS ^

function targetA=rank2gbellParam(rank, compModelNum, targetScore, plotOpt)

DESCRIPTION ^

 rank2gbellParam: Return the parameter "a" of a generalized bell function based on a vector of given ranks.
    方法:找出參數 a,使得 rank/compModelNum 丟入 [a, defB, defC] 的 gbellmf 的平均值是 targetScore

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function targetA=rank2gbellParam(rank, compModelNum, targetScore, plotOpt)
0002 % rank2gbellParam: Return the parameter "a" of a generalized bell function based on a vector of given ranks.
0003 %    方法:找出參數 a,使得 rank/compModelNum 丟入 [a, defB, defC] 的 gbellmf 的平均值是 targetScore
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;    % Default values of a, b, c
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)    % targetScore is outside the range of meanScore
0027     targetA=defA;
0028 %    plot(a, meanScore, '.-');
0029 %    line(targetA, targetScore, 'color', 'r', 'marker', 'o');
0030 %    [ranks, rankCount]=elementCount(rank);
0031 %    title(sprintf('ranks=%s, rankCount=%s, compModelNum=%d', mat2str(ranks), mat2str(rankCount), compModelNum));
0032 %    xlabel('Rank ratio'); ylabel('Average score');
0033 %    grid on
0034 %    keyboard;
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 %    keyboard
0051 end
0052 
0053 % ====== self demo
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 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 3 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 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 0 1 0 1 0 0 0 0 0 0 0 0 0 0 2 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 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 0 1 0 3 6 1 1 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 1 1 2 0 0 0 0 0 0 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