diff --git a/src/Forest.h b/src/Forest.h index e9279154..265d8c78 100644 --- a/src/Forest.h +++ b/src/Forest.h @@ -147,6 +147,7 @@ class Forest { std::vector> getNumSamplesNodes() { std::vector> result; + result.reserve(trees.size()); for (auto& tree : trees) { result.push_back(tree->getNumSamplesNodes()); } @@ -154,6 +155,7 @@ class Forest { } std::vector> getNodePredictions() { std::vector> result; + result.reserve(trees.size()); for (auto& tree : trees) { result.push_back(tree->getNodePredictions()); } @@ -161,6 +163,7 @@ class Forest { } std::vector> getSplitStats() { std::vector> result; + result.reserve(trees.size()); for (auto& tree : trees) { result.push_back(tree->getSplitStats()); }