perClass Documentation
version 5.4 (7-Dec-2018)
CONSTRAIN Get a subset of op.points based on performance constraints

   R2=CONSTRAIN(R,measure,constraint,...)
   [R2,IND]=CONSTRAIN(R,measure,constraint,...)

 Use multiple constraints in normalized confusion matrix:
   [R2,IND]=CONSTRAIN(R,'nconfmat',NCM)

 INPUT
   R            SDROC object
   measure      measure definition (index or name such as 'err(apple)')
   constraints  scalar constraint value

 OUTPUT
   R2           SDROC subset fulfilling all constraints or empty
   IND          Indices of the R2 subset in R

 DESCRIPTION
 CONSTRAIN method applies one or more constraints on the estimated
 measures. The measures may be specified by their index or by name.  For
 each measure we only need to provide scalar value, the polarity is chosen
 automatically (errors are minimized, performances maximized).
 It is possible to provide multiple measures in normalized conf.matrix NCM.
 Fields with NaN values are ignored.

 EXAMPLES
  >>  r2=constrain(r,'TPr(banana)',0.8)
  >>  r2=constrain(r,'TPr(banana)',0.8,'error(fruit)',0.3)

 Multiple constrains in a matrix:
  >> load fruit; [tr,ts]=randsubset(a,0.5);
  >> p=sdgauss(tr)
  >> r=sdroc(ts,p,'confmat')
  >> Q=NaN*ones(3); Q(3,2)=0.2; Q(1,1)=0.95; Q(2,2)=0.6
  >> r2=constrain(r,'nconfmat',Q)