⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rocvector.m.svn-base

📁 a function inside machine learning
💻 SVN-BASE
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -