confmatrix

PURPOSE ^

Generates a confusion matrix according to true and predicted data labels.

SYNOPSIS ^

function CM = confmatrix( IDXtrue, IDXpred, ntypes )

DESCRIPTION ^

 Generates a confusion matrix according to true and predicted data labels.

 CM(i,j) denotes the number of elements of class i that were given label j.  In other
 words, each row i contains the predictions for elements whos actual class was i.  If
 IDXpred is perfect, then CM is a diagnol matrix with CM(i,i) equal to the number of
 instances of class i.  

 To normalize CM to fall between [0,1], divide each row by the sum of that row:
   CMnorm = CM ./ repmat( sum(CM,2), [1 size(CM,2)] );

 INPUTS
   IDXtrue     - nx1 array of true labels [int values between 1 and ntypes]
   IDXpred     - nx1 array of predicted labels [int values between 1 and ntypes]
   ntypes      - maximum number of types (should be > max(IDX))

 OUTPUTS
   CM          - ntypes x ntypes confusion array with integer values

 DATESTAMP
   29-Sep-2005  2:00pm

 See also CONFMATRIX_SHOW

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 03-May-2006 23:48:50 by m2html © 2003