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.

Description of slcorrectrate_blks
Home > sltoolbox > perfeval > slcorrectrate_blks.m

slcorrectrate_blks

PURPOSE ^

SLCORRECTRATE_BLKS Computes the correct rate based on blockwise scores

SYNOPSIS ^

function cr = slcorrectrate_blks(scores, blocks, clabels, qlabels, op, varargin)

DESCRIPTION ^

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

CROSS-REFERENCE INFORMATION ^

This function calls:
  • raise_lackinput RAISE_LACKINPUT Raises an error indicating lack of input argument
  • slclassify_blks SLCLASSIFY_BLKS Classifies samples according to blockwise scores
This function is called by:

SOURCE CODE ^

0001 function cr = slcorrectrate_blks(scores, blocks, clabels, qlabels, op, varargin)
0002 %SLCORRECTRATE_BLKS Computes the correct rate based on blockwise scores
0003 %
0004 % $ Syntax $
0005 %   - cr = slcorrectrate_blks(scores, blocks, clabels, qlabels, op, ...)
0006 %
0007 % $ Arguments $
0008 %   - scores:       the score matrix
0009 %   - blocks:       the cell array of block limits
0010 %   - clabels:      the class labels of reference samples
0011 %   - qlabels:      the query labels of query samples
0012 %   - op:           the score attribute
0013 %   - cr:           the computed classification correct rate
0014 %
0015 % $ Remarks $
0016 %   - An extension of slcorrectrate to support blockwise scores
0017 %
0018 % $ History $
0019 %   - Created by Dahua Lin, on Aug 9th, 2006
0020 %   - Modified by Dahua Lin on Aug 16th, 2006
0021 %     - Based on new slclassify to support multiple schemes
0022 %
0023 
0024 %% parse and verify input arguments
0025 
0026 if nargin < 5
0027     raise_lackinput('slcorrectrate_blks', 5);
0028 end
0029 
0030 
0031 %% Make decision
0032 
0033 n = length(qlabels);
0034 decisions = slclassify_blks(scores, n, blocks, clabels, op, varargin{:});
0035 
0036 %% Evaluate correct rate
0037 
0038 qlabels = qlabels(:)';
0039 cr = sum(decisions == qlabels) / length(qlabels);
0040 
0041 
0042

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com