@Override
public Serializable getClassificationByMaxProb(AttributesMap attributes) {
Map<Serializable, AtomicDouble> probTotals = Maps.newHashMap();
for (Tree tree : trees) {
Leaf leaf =tree.node.getLeaf(attributes);
for (Serializable classification : leaf.getClassifications()) {
AtomicDouble ttlProb = probTotals.get(classification);
if (ttlProb == null) {
ttlProb = new AtomicDouble(0);
probTotals.put(classification, ttlProb);
}
ttlProb.addAndGet(leaf.getProbability(classification));
}
}
Serializable bestClassification = null;
double bestClassificationTtlProb = 0;
for (Map.Entry<Serializable, AtomicDouble> classificationProb : probTotals.entrySet()) {