Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

slcorrectrate_blks(scores, blocks, clabels, qlabels, op, varargin)
function cr = slcorrectrate_blks(scores, blocks, clabels, qlabels, op, varargin)
%SLCORRECTRATE_BLKS Computes the correct rate based on blockwise scores
%
% $ Syntax $
%   - cr = slcorrectrate_blks(scores, blocks, clabels, qlabels, op, ...)
%
% $ Arguments $
%   - scores:       the score matrix
%   - blocks:       the cell array of block limits
%   - clabels:      the class labels of reference samples
%   - qlabels:      the query labels of query samples
%   - op:           the score attribute  
%   - cr:           the computed classification correct rate
%
% $ Remarks $
%   - An extension of slcorrectrate to support blockwise scores
%
% $ History $
%   - Created by Dahua Lin, on Aug 9th, 2006
%   - Modified by Dahua Lin on Aug 16th, 2006
%     - Based on new slclassify to support multiple schemes
%

%% parse and verify input arguments

if nargin < 5
    raise_lackinput('slcorrectrate_blks', 5);
end


%% Make decision

n = length(qlabels);
decisions = slclassify_blks(scores, n, blocks, clabels, op, varargin{:});

%% Evaluate correct rate

qlabels = qlabels(:)';
cr = sum(decisions == qlabels) / length(qlabels);



Contact us at files@mathworks.com