// Public methods.
void RandomForestBuilder::build() {
  common::debug::print("Creating %d random tree(s)\n", classificatorParameters.RandomTreesCount);

  Trees trainedRandomTrees;
  trainedRandomTrees.reserve(classificatorParameters.RandomTreesCount);

  for (int i = 0; i < classificatorParameters.RandomTreesCount; ++i) {
    std::vector<int> trainingSet;
    std::vector<int> outOfBagSet;

    generateBootStrap(trainingSet, outOfBagSet);

    RandomTreeBuilder treeBuilder(featuresCollection, trainingSet, classificatorParameters);
    treeBuilder.build();

    trainedRandomTrees.push_back(treeBuilder.getTreeStructure());
    common::debug::print("[%d] Trained Random Tree...\n", i + 1);
  }

  cleanUp();
  forest = new RandomForest(trainedRandomTrees, featuresCollection.size());
}