public double[] distributionForInstance(Instance instance) throws Exception {
  if (!m_MinimizeExpectedCost) {
    return m_Classifier.distributionForInstance(instance);
  }
  double[] pred=m_Classifier.distributionForInstance(instance);
  double[] costs=m_CostMatrix.expectedCosts(pred,instance);
  int classIndex=Utils.minIndex(costs);
  for (int i=0; i < pred.length; i++) {
    if (i == classIndex) {
      pred[i]=1.0;
    }
 else {
      pred[i]=0.0;
    }
  }
  return pred;
}

public double [ ] distributionForInstance ( Instance instance ) throws Exception { if ( ! m_MinimizeExpectedCost ) { return m_Classifier . distributionForInstance ( instance ) ; } double [ ] pred = m_Classifier . distributionForInstance ( instance ) ; double [ ] costs = m_CostMatrix . expectedCosts ( pred , instance ) ; int classIndex = Utils . minIndex ( costs ) ; for ( int i = 0 ; i < pred . length ; i ++ ) { if ( i == classIndex ) { pred [ i ] = 1.0 ; } else { pred [ i ] = 0.0 ; } } return pred ; }
returns class probabilities . when minimum expected cost approach is chosen , returns probability one for class with the minimum expected misclassification cost . otherwise it returns the probability distribution returned by the base classifier .
