accuracy.m.svn-base

来自「a function inside machine learning」· SVN-BASE 代码 · 共 12 行

SVN-BASE
12
字号
function acc = accuracy(trueY, predictedY, ranking) 
%Compute the accuracy of a set of predictions for binary labels 
%In the multi label case, all labels must be correct for 1 example

if (nargin < 2)
    fprintf('%s\n', help(sprintf('%s', mfilename)));
    error('Incorrect number of inputs - see above usage instructions.');
end

[numExamples, numLabels] = size(trueY);

acc = sum(sum(trueY == predictedY, 2) == numLabels)/(numExamples);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?