/** * Convert distribution using minimum expected cost approach. The incoming * array is modified and returned! * * @param pred the predicted distribution * @param instance the instance * @return the modified distribution */ protected double[] convertDistribution(double[] pred, Instance instance) throws Exception { double [] costs = m_CostMatrix.expectedCosts(pred, instance); // This is probably not ideal 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; }
/** * Convert distribution using minimum expected cost approach. The incoming * array is modified and returned! * * @param pred the predicted distribution * @param instance the instance * @return the modified distribution */ protected double[] convertDistribution(double[] pred, Instance instance) throws Exception { double [] costs = m_CostMatrix.expectedCosts(pred, instance); // This is probably not ideal 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; }
return expectedCosts(classProbs);
return expectedCosts(classProbs);