protected void cleanup(Context context) throws IOException, InterruptedException {
// prepare the data
log.debug("partition: " + partition + "numInstances: " + instances.size());
Data data = new Data(getDataset(), instances);
Bagging bagging = new Bagging(getTreeBuilder(), data);
TreeID key = new TreeID();
log.debug("Building " + nbTrees + " trees");
SingleTreePredictions callback = null;
int[] predictions = null;
for (int treeId = 0; treeId < nbTrees; treeId++) {
log.debug("Building tree N° : " + treeId);
if (isOobEstimate() && !isNoOutput()) {
callback = new SingleTreePredictions(data.size());
predictions = callback.getPredictions();
}
Node tree = bagging.build(treeId, rng, callback);
key.set(partition, firstTreeId + treeId);
if (!isNoOutput()) {
MapredOutput emOut = new MapredOutput(tree, predictions);