adjustThreshold
PURPOSE
function [ab, clErr] = adjustThreshold(ab, trainingExamples, targetOuts, reqDetRate)
SYNOPSIS
function [ab, clErr, resDetRate] = adjustThreshold(ab, trainingExamples, targetOuts, reqDetRate)
DESCRIPTION
CROSS-REFERENCE INFORMATION
This function calls:
This function is called by:
- learn function [ab, err] = learn(ab, trnExamples, targetOuts, nStages, reqDetRate)
SOURCE CODE
0001 function [ab, clErr, resDetRate] = adjustThreshold(ab, trainingExamples, targetOuts, reqDetRate)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 [clOuts, realOuts] = computeOutputs(ab, trainingExamples);
0017 posVal = getPosVal(ab);
0018 negVal = getNegVal(ab);
0019 posIndxs = find(targetOuts == posVal);
0020 numPos = length(posIndxs);
0021 targetPos = ceil(numPos * reqDetRate);
0022 numDetPos = sum(clOuts == posVal & targetOuts == posVal);
0023 if targetPos > numDetPos,
0024
0025
0026 cmpSign = sign(posVal - negVal);
0027 if cmpSign > 0,
0028 sortMode = 'ascend';
0029 else
0030 sortMode = 'descend';
0031 end
0032 sortedPosOuts = sort(realOuts(posIndxs), sortMode);
0033 ab.thresh = sortedPosOuts(numPos - targetPos + 1);
0034 clOuts = computeOutputs(ab, trainingExamples);
0035 end
0036 clErr = sum(clOuts ~= targetOuts) / length(clOuts);
0037 resDetRate = sum((targetOuts == posVal) & (clOuts == posVal)) / ...
0038 sum((targetOuts == posVal));
0039 ab.detectionRate = resDetRate;
Generated on Sun 29-Sep-2013 01:25:24 by m2html © 2005