rocvector.m.svn-base
来自「a function inside machine learning」· SVN-BASE 代码 · 共 29 行
SVN-BASE
29 行
function roc = ROCvector(trueY, predictedY, ranking, numPoints)
%Output the ROC curve vector
roc = ones(numPoints, 2);
numExamples = size(trueY, 1);
%Sort examples by their ranking
tempM = [ranking, trueY, predictedY];
tempM = sortrows(tempM);
ranking = tempM(:, 1);
trueY = tempM(:, 2);
predictedY = tempM(:, 3);
%We may end before the last example, but its probably okay
exampleStep = floor((numExamples-1)/(numPoints-1));
currentExample = 1;
for i=1:numPoints
currentThreshold = ranking(currentExample);
newPredictedY = (ranking > currentThreshold)*2 - 1;
roc(i, 1) = falsePositiveRate(trueY, newPredictedY);
roc(i, 2) = truePositiveRate(trueY, newPredictedY);
currentExample = currentExample + exampleStep;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?