Ask Your Question

Memory allocation problems with GBT

asked 2014-01-13 00:19:49 -0600

stefangachter gravatar image

I have issues with the training of Gradient Boosting Trees, using OpenCV 2.4.6. If the combination of number of trees and maximum depth is too big, the training function throws a bad allocation error. Has anybody similar problems with GBT?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-01-15 01:44:44 -0600

stefangachter gravatar image

The maximum depth of the trees is limited by the available memory, as can be seen from the following code snippet:

CvDTreeNode** CvGBTrees::GetLeaves( const CvDTree* dtree, int& len )
    len = 0;
    CvDTreeNode** leaves = new pCvDTreeNode[(size_t)1 << params.max_depth];
    leaves_get(leaves, len, const_cast<pCvDTreeNode>(dtree->get_root()));
    return leaves;

Therefore, maximum depth of tree should be kept small, according to Hastie et al., The elements of statistics, 2 (decision Stumps) will be sufficient in many applications and it is unlikely that the depth exceeds 10.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-01-13 00:19:49 -0600

Seen: 232 times

Last updated: Jan 15 '14