The way cv::ml::rtrees seems to calculate the oob error is as follows:
- For loop iterates through the all the trees
For each tree:
i. oob error is set to 0.0
ii. oob error is properly calculate for this particular tree
iii. At end of each loop, the oob error for that tree is compared to the EPS and, if below, breaks out of loop
There are 2 main issues with code:
The oob error is only calculated per tree and then set to 0.0 for next tree (i.e. there is no average oob error being calculated for all trees)
If none of the oob errors per tree is below the EPS, the final oob error reported (and stored when we save out the model) is the oob error of the last tree in the forest
This looks to me like a bug???