CERROR

Computes classification error.



 Synopsis:
  error = cerror(y1,y2)
  error = cerror(y1,y2,label) 

 Description:
  error = cerror(y1,y2) returns classification error, i.e.,
      error=  1/length(y1) sum_i L( y1(i), y2(i))

    where L(a,b)=0 if a==b and L(a,b)=1 if a ~= b.

  error = cerror(y1,y2,label) considers only labels
    find(y2==label), i.e., if y1,y2 from {-1,1} then

   false_positives_rate = cerror(y1,y2,-1)
   false_negatives_rate = cerror(y1,y2,+1)

 Input:
  y1 [1 x n] Vector of integers (response of classifier).
  y2 [1 x n] Vector of integers (ground truth).
  label [int] Selected label.

 Output:
  error [real] Error. 

 Example:
  classifier  = [+1,+1,+1,-1]
  groundtruth = [-1,+1,-1,+1]
  error = cerror(classifier,groundtruth)
  false_pos = cerror(classifier,groundtruth,-1)
  false_neg = cerror(classifier,groundtruth,1)

 See also
  ROC


Source: cerror.m

About: Statistical Pattern Recognition Toolbox
(C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac
Czech Technical University Prague
Faculty of Electrical Engineering
Center for Machine Perception

Modifications:
09-jun-2004, VF
14-Jan-2003, VF