private void writeFeatureResult( String featureName, String featureOutcome, double value, Map<String, Double> outcomeTotals) throws IOException { writer.append("#" + featureName + "\t"); writer.append("outcome=" + featureOutcome + "\n"); writer.append("value=" + String.format("%1$-30s", value) + "\n"); writer.append( String.format("%1$-30s", "outcome") + String.format("%1$#15s", "weight") + String.format("%1$#15s", "total") + "\n"); int featureIndex = modelParams.getFeatureIndex(featureName); if (featureIndex >= 0) { double[] classWeights = modelParams.getFeatureWeights()[featureIndex]; int j = 0; for (String outcome : modelParams.getOutcomes()) { double weight = classWeights[j]; double total = value * weight; writer.append( String.format("%1$-30s", outcome) + String.format("%1$#15s", decFormat.format(weight)) + String.format("%1$#15s", decFormat.format(total)) + "\n"); double runningTotal = outcomeTotals.get(outcome); runningTotal += total; outcomeTotals.put(outcome, runningTotal); j++; } } writer.append("\n"); }