2013-10-21 81 views
3

我正在使用16類問題的決策樹。我將參數設置爲OpenCV決策樹參數問題

CvDTreeParams params = CvDTreeParams(50, // max depth 
    100,// min sample count 
    0, // regression accuracy: N/A here 
    true, // compute surrogate split, no missing data 
    16, // max number of categories (use sub-optimal algorithm for larger numbers) 
    5, // the number of cross-validation folds 
    false, // use 1SE rule => smaller tree 
    false, // throw away the pruned tree branches 
    priors // the array of priors 
); 
CvDTree* dtree = new CvDTree(); 
dtree->train(data, CV_ROW_SAMPLE, classes, 
    Mat(), Mat(), var_type, Mat(), params); 

但是生成的樹僅給出了最大深度25。這不是增加深度。我在Matlab上嘗試了相同的數據,並且樹深度爲50.是否有限制OpenCV中樹的深度?

回答

2

OpenCV源代碼中最大深度的硬限制爲25。所以必須改變二進制文件才能使其工作。