| 808 | //-------------------------------- CascadeBoostTree ---------------------------------------- |
| 809 | |
| 810 | CvDTreeNode* CascadeBoostTree::predict( int sampleIdx ) const |
| 811 | { |
| 812 | CvDTreeNode* node = root; |
| 813 | if( !node ) |
| 814 | CV_Error( CV_StsError, "The tree has not been trained yet" ); |
| 815 | |
| 816 | if ( ((CascadeBoostTrainData*)data)->featureEvaluator->getMaxCatCount() == 0 ) // ordered |
| 817 | { |
| 818 | while( node->left ) |
| 819 | { |
| 820 | CvDTreeSplit* split = node->split; |
| 821 | float val = ((CascadeBoostTrainData*)data)->getVarValue( split->var_idx, sampleIdx ); |
| 822 | node = val <= split->ord.c ? node->left : node->right; |
| 823 | } |
| 824 | } |
| 825 | else // categorical |
| 826 | { |
| 827 | while( node->left ) |
| 828 | { |
| 829 | CvDTreeSplit* split = node->split; |
| 830 | int c = (int)((CascadeBoostTrainData*)data)->getVarValue( split->var_idx, sampleIdx ); |
| 831 | node = CV_DTREE_CAT_DIR(c, split->subset) < 0 ? node->left : node->right; |
| 832 | } |
| 833 | } |
| 834 | return node; |
| 835 | } |
| 836 | |
| 837 | void CascadeBoostTree::split_node_data( CvDTreeNode* node ) |
| 838 | { |
no test coverage detected