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 slverifyroc
Home > sltoolbox > perfeval > slverifyroc.m

slverifyroc

PURPOSE ^

SLVERIFYROC Computes the verification ROC

SYNOPSIS ^

function [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op, npts)

DESCRIPTION ^

SLVERIFYROC Computes the verification ROC

 $ Syntax $
   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op)
   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op, npts)
 
 $ Arguments $
   - scores:       the score matrix for verification
   - labels1:      the labels of referred samples
   - labels2:      the labels of query samples
   - op:           the option stating the attributes of the scores
   - npts:         the number of threshold points (default = 200)
   - thrs:         the sampled thresholds
   - fars:         the false accept rates at the sampled thresholds
   - frrs:         the false reject rates at the sampled thresholds

 $ Description $
   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op) 
     Computes the verification ROC based on the pairwise scores. 
     If there are m samples in the first set, n samples in the second set, 
     then the scores matrix should be of size m x n, and the labels1 and 
     labels2 should be a vector of m and n elements respectively. 
     If labels2 is given empty, then it is supposed to be the same as 
     labels1, where we are performing self-pairwise-verification.
     Here op can be 'low' or 'high', if op is 'high' means that a higher
     score indicating higher similarity, vice versa for 'low' op. 
     For output, if n thresholds are sampled, then thrs, fars, and frrs
     for all n x 1 vectors, containing the sampled threshold values,
     and the corresponding false accept rates, and false reject rates.

   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op, npts)
     You can specify the number of threshold points to sampled by npts.

 $ History $
   - Created by Dahua Lin on Jun 10th, 2005
   - Modified by Dahua Lin on May 1st, 2006
     - Base on the sltoolbox v4
   - Modified by Dahua Lin on Aug 8th, 2006
     - Add one more argument npts to tune the density of sampling

CROSS-REFERENCE INFORMATION ^

This function calls:
  • slroc SLROC Computes the ROC
  • raise_lackinput RAISE_LACKINPUT Raises an error indicating lack of input argument
This function is called by:

SOURCE CODE ^

0001 function [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op, npts)
0002 %SLVERIFYROC Computes the verification ROC
0003 %
0004 % $ Syntax $
0005 %   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op)
0006 %   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op, npts)
0007 %
0008 % $ Arguments $
0009 %   - scores:       the score matrix for verification
0010 %   - labels1:      the labels of referred samples
0011 %   - labels2:      the labels of query samples
0012 %   - op:           the option stating the attributes of the scores
0013 %   - npts:         the number of threshold points (default = 200)
0014 %   - thrs:         the sampled thresholds
0015 %   - fars:         the false accept rates at the sampled thresholds
0016 %   - frrs:         the false reject rates at the sampled thresholds
0017 %
0018 % $ Description $
0019 %   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op)
0020 %     Computes the verification ROC based on the pairwise scores.
0021 %     If there are m samples in the first set, n samples in the second set,
0022 %     then the scores matrix should be of size m x n, and the labels1 and
0023 %     labels2 should be a vector of m and n elements respectively.
0024 %     If labels2 is given empty, then it is supposed to be the same as
0025 %     labels1, where we are performing self-pairwise-verification.
0026 %     Here op can be 'low' or 'high', if op is 'high' means that a higher
0027 %     score indicating higher similarity, vice versa for 'low' op.
0028 %     For output, if n thresholds are sampled, then thrs, fars, and frrs
0029 %     for all n x 1 vectors, containing the sampled threshold values,
0030 %     and the corresponding false accept rates, and false reject rates.
0031 %
0032 %   - [thrs, fars, frrs] = slverifyroc(scores, labels1, labels2, op, npts)
0033 %     You can specify the number of threshold points to sampled by npts.
0034 %
0035 % $ History $
0036 %   - Created by Dahua Lin on Jun 10th, 2005
0037 %   - Modified by Dahua Lin on May 1st, 2006
0038 %     - Base on the sltoolbox v4
0039 %   - Modified by Dahua Lin on Aug 8th, 2006
0040 %     - Add one more argument npts to tune the density of sampling
0041 %
0042 
0043 %% parse and verify input arguments
0044 if nargin < 4
0045     raise_lackinput('slverifyroc', 4);
0046 end
0047 if isempty(labels2)
0048     labels2 = labels1;
0049 end
0050 if ndims(scores) ~= 2
0051     error('sltoolbox:invaliddims', ...
0052         'The scores should be a 2D matrix');
0053 end
0054 [m, n] = size(scores);
0055 if length(labels1) ~= m || length(labels2) ~= n 
0056     error('The sizes of labels do not match that of scores');
0057 end
0058 
0059 if nargin < 5 || isempty(npts)
0060     npts = 200;
0061 end
0062 
0063 
0064 %% generate the signs
0065 labels1 = labels1(:);
0066 labels2 = labels2(:)';
0067 L1 = labels1(:, ones(1, n));
0068 L2 = labels2(ones(m, 1), :);
0069 signals = (L1 == L2);
0070 clear L1 L2;
0071 
0072 %% compute
0073 [thrs, fars, frrs] = slroc(scores, signals, npts, op);
0074 
0075 
0076 
0077

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

Contact us at files@mathworks.com