OpenCV决策树参数问题

时间:2013-10-21 18:26:45

标签: c++ opencv machine-learning

我正在使用16类问题的决策树。我将参数设置为

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中的树深度是否有任何限制?

1 个答案:

答案 0 :(得分:2)

OpenCV源代码中最大深度的硬限制为25。因此必须更改二进制文件才能使其正常工作。

相关问题