BAYESERR

Bayesian risk for 1D Gaussians and 0/1-loss.



 Synopsis:
  [risk,eps1,eps2,inter1] = bayeserr(model)

 Description:
  This function computes Bayesian risk of a classifier 
  with the following assumptions:
   - 1/0 loss function (risk = expectation of misclassification).
   - Binary classification.
   - Class conditional probabilities are univariate Gaussians.

 Input:
  model [struct] Mixture of two univariate Gaussians.
   .Mean [1x2] Mean values [Mean1 Mean2].
   .Cov [1x2] Covariances [Cov1 Cov2].
   .Prior [1x2] A priory probabilities.
 
 Output:
  risk [1x1] Bayesian risk for an optimal classifier.
  eps1 [1x1] Integral of p(x|k=1) over x in L2, where
    L2 is the area where x is classified to the 2nd class.
  eps2 [1x1] Integral of p(x|k=2) over x in L1, where
    L1 is the area where x is classified to the 1st class.
  inter1 [1x2] or [1x4] One or two intervals describing L1.

 Example:
  model = struct('Mean',[0 0],'Cov',[1 0.4],'Prior',[0.4 0.6]);
  figure; hold on; 
  h = pgmm(model,struct('comp_color',['r' 'g'])); 
  legend(h,'P(x)','P(x|y=1)*P(y=1)','P(x|y=2)*P(y=2)');
  [risk,eps1,eps2,interval] = bayeserr(model)
  a = axis;
  plot([interval(2) interval(2)],[a(3) a(4)],'k');
  plot([interval(3) interval(3)],[a(3) a(4)],'k');

 See also
  BAYESDFBAYESCLS


Source: bayeserr.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:
22-oct-2009, VF, fixed bug on line 157; bug reported 2009-10-08 by krejci.filip@gmail.com
20-mar-2006, VF, A mistake in help removed; bug reported by O. Sychrovksy.
02-may-2004, VF
19-sep-2003, VF
27-Oct-2001, VF