private double predictAsLeaf(Example example, ExtendedTree node) {
    double dPrediction = 0;
    Iterator<String> s = node.getCounterMap().keySet().iterator();
    int[] counts = new int[getLabel().getMapping().size()];
    int sum = 0;
    while (s.hasNext()) {
      String className = s.next();
      int count = node.getCount(className);
      int index = getLabel().getMapping().getIndex(className);
      counts[index] = count;
      sum += count;
    }
    for (int i = 0; i < counts.length; i++) {
      example.setConfidence(
          getLabel().getMapping().mapIndex(i), smoothedConfidence(counts[i], sum));
    }

    dPrediction = getLabel().getMapping().getIndex(node.getLabel());

    return dPrediction;
  }