|
|
@ -340,26 +340,6 @@ int DTreesImpl::addTree(const vector<int>& sidx ) |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
w_nidx = w->wnodes[w_pidx].right; |
|
|
|
w_nidx = w->wnodes[w_pidx].right; |
|
|
|
#if 1 |
|
|
|
|
|
|
|
if( w_nidx < 0 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
size_t i, nnodes = w->wnodes.size(); |
|
|
|
|
|
|
|
printf("w_pidx = %d\nwnodes (%d): ", w_pidx, (int)n); |
|
|
|
|
|
|
|
for( i = 0; i < nnodes; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
printf("[%d. depth=%d parent=%d, left=%d, right=%d] ", |
|
|
|
|
|
|
|
(int)i, w->wnodes[i].depth, w->wnodes[i].parent, w->wnodes[i].left, w->wnodes[i].right); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nnodes = nodes.size(); |
|
|
|
|
|
|
|
printf("\nnodes (%d): ", (int)nnodes); |
|
|
|
|
|
|
|
for( i = 0; i < nnodes; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
printf("[%d. parent=%d, left=%d, right=%d] ", (int)i, nodes[i].parent, nodes[i].left, nodes[i].right); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
printf("\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
CV_Assert( w_nidx >= 0 ); |
|
|
|
CV_Assert( w_nidx >= 0 ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -450,8 +430,10 @@ int DTreesImpl::addNodeAndTrySplit( int parent, const vector<int>& sidx ) |
|
|
|
if( params.useSurrogates ) |
|
|
|
if( params.useSurrogates ) |
|
|
|
CV_Error( CV_StsNotImplemented, "surrogate splits are not implemented yet"); |
|
|
|
CV_Error( CV_StsNotImplemented, "surrogate splits are not implemented yet"); |
|
|
|
|
|
|
|
|
|
|
|
w->wnodes[nidx].left = addNodeAndTrySplit( nidx, sleft ); |
|
|
|
int left = addNodeAndTrySplit( nidx, sleft ); |
|
|
|
w->wnodes[nidx].right = addNodeAndTrySplit( nidx, sright ); |
|
|
|
int right = addNodeAndTrySplit( nidx, sright ); |
|
|
|
|
|
|
|
w->wnodes[nidx].left = left; |
|
|
|
|
|
|
|
w->wnodes[nidx].right = right; |
|
|
|
CV_Assert( w->wnodes[nidx].left > 0 && w->wnodes[nidx].right > 0 ); |
|
|
|
CV_Assert( w->wnodes[nidx].left > 0 && w->wnodes[nidx].right > 0 ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|