Home | History | Annotate | Download | only in src

Lines Matching refs:split

269     // now calculate the maximum size of split,
810 node->split = 0;
847 CvDTreeSplit* split = (CvDTreeSplit*)cvSetNew( split_heap );
848 split->var_idx = vi;
849 split->ord.c = cmp_val;
850 split->ord.split_point = split_point;
851 split->inversed = inversed;
852 split->quality = quality;
853 split->next = 0;
855 return split;
861 CvDTreeSplit* split = (CvDTreeSplit*)cvSetNew( split_heap );
864 split->var_idx = vi;
865 split->inversed = 0;
866 split->quality = quality;
868 split->subset[i] = 0;
869 split->next = 0;
871 return split;
877 CvDTreeSplit* split = node->split;
879 while( split )
881 CvDTreeSplit* next = split->next;
882 cvSetRemoveByPtr( split_heap, split );
883 split = next;
885 node->split = 0;
1367 // TODO: check the split quality ...
1368 node->split = best_split;
1385 CvDTreeSplit* split;
1392 split = find_surrogate_split_cat( node, vi );
1394 split = find_surrogate_split_ord( node, vi );
1396 if( split )
1398 // insert the split
1399 CvDTreeSplit* prev_split = node->split;
1400 split->quality = (float)(split->quality*quality_scale);
1403 prev_split->next->quality > split->quality )
1405 split->next = prev_split->next;
1406 prev_split->next = split;
1418 // for each sample using the best split
1419 // the function returns scale coefficients for surrogate split quality factors.
1420 // the scale is applied to normalize surrogate split quality relatively to the
1421 // best (primary) split quality. That is, if a surrogate split is absolutely
1422 // identical to the primary split, its quality will be set to the maximum value =
1423 // quality of the primary split; otherwise, it will be lower.
1426 // for a surrogate split. Surrogate splits with quality less than node->maxlr
1431 int i, n = node->sample_count, vi = node->split->var_idx;
1434 assert( !node->split->inversed );
1436 if( data->get_var_type(vi) >= 0 ) // split on categorical var
1439 const int* subset = node->split->subset;
1475 else // split on ordered var
1478 int split_point = node->split->ord.split_point;
1523 return node->split->quality/(L + R);
1530 CvDTreeSplit *best_split = 0, *split = 0, *t;
1541 split = find_split_cat_class( node, vi );
1543 split = find_split_ord_class( node, vi );
1548 split = find_split_cat_reg( node, vi );
1550 split = find_split_ord_reg( node, vi );
1553 if( split )
1555 if( !best_split || best_split->quality < split->quality )
1556 CV_SWAP( best_split, split, t );
1557 if( split )
1558 cvSetRemoveByPtr( data->split_heap, split );
1581 // init arrays of class instance counters on both sides of the split
1758 CvDTreeSplit* split;
1903 split = data->new_split_cat( vi, (float)best_val );
1910 split->subset[idx >> 5] |= 1 << (idx & 31);
1919 split->subset[i >> 5] |= 1 << (i & 31);
1923 return split;
1942 // find the optimal split
1969 CvDTreeSplit* split;
2037 split = data->new_split_cat( vi, (float)best_val );
2041 split->subset[idx >> 5] |= 1 << (idx & 31);
2044 return split;
2055 // LR - ... primary split sends to the left and the surrogate split sends to the right
2056 // RL - ... primary split sends to the right and the surrogate split sends to the left
2077 // initially all the samples are sent to the right by the surrogate split,
2078 // LR of them are sent to the left by primary split, and RR - to the right.
2079 // now iteratively compute LL, LR, RL and RR for every possible surrogate split value.
2126 // initially all the samples are sent to the right by the surrogate split,
2127 // LR of them are sent to the left by primary split, and RR - to the right.
2128 // now iteratively compute LL, LR, RL and RR for every possible surrogate split value.
2168 // LR - ... primary split sends to the left and the surrogate split sends to the right
2169 // RL - ... primary split sends to the right and the surrogate split sends to the left
2171 CvDTreeSplit* split = data->new_split_cat( vi, 0 );
2181 // sent to the left (lc) and to the right (rc) by the primary split
2231 // 2. now form the split.
2238 split->subset[i >> 5] |= 1 << (i & 31);
2246 split->quality = (float)best_val;
2247 if( split->quality <= node->maxlr || l_win == 0 || l_win == mi )
2248 cvSetRemoveByPtr( data->split_heap, split ), split = 0;
2250 return split;
2439 int nz = n - node->get_num_valid(node->split->var_idx);
2445 CvDTreeSplit* split = node->split->next;
2446 for( ; split != 0 && nz; split = split->next )
2448 int inversed_mask = split->inversed ? -1 : 0;
2449 vi = split->var_idx;
2451 if( data->get_var_type(vi) >= 0 ) // split on categorical var
2454 const int* subset = split->subset;
2468 else // split on ordered var
2471 int split_point = split->ord.split_point;
2526 // do not physically split the input data between the left and right child nodes
2527 // when we are not going to split them further,
2550 // split ordered variables, keep both halves sorted.
2566 // split sorted
2582 // split missing
2597 // split categorical vars, responses and cv_labels using new_idx relocation table
2939 CvDTreeSplit* split = node->split;
2941 for( ; !dir && split != 0; split = split->next )
2943 int vi = split->var_idx;
2950 dir = val <= split->ord.c ? -1 : 1;
2985 dir = CV_DTREE_CAT_DIR(c, split->subset);
2988 if( split->inversed )
3025 CvDTreeSplit* split = node->split;
3030 for( ; split != 0; split = split->next )
3031 importance[split->var_idx] += split->quality;
3051 void CvDTree::write_split( CvFileStorage* fs, CvDTreeSplit* split )
3056 cvWriteInt( fs, "var", split->var_idx );
3057 cvWriteReal( fs, "quality", split->quality );
3059 ci = data->get_var_type(split->var_idx);
3060 if( ci >= 0 ) // split on a categorical var
3064 to_right += CV_DTREE_CAT_DIR(i,split->subset) > 0;
3066 // ad-hoc rule when to use inverse categorical split notation
3070 cvStartWriteStruct( fs, default_dir*(split->inversed ? -1 : 1) > 0 ?
3075 int dir = CV_DTREE_CAT_DIR(i,split->subset);
3082 cvWriteReal( fs, !split->inversed ? "le" : "gt", split->ord.c );
3090 CvDTreeSplit* split;
3112 for( split = node->split; split != 0; split = split->next )
3113 write_split( fs, split );
3194 CvDTreeSplit* split = 0;
3207 CV_ERROR( CV_StsOutOfRange, "Split variable index is out of range" );
3210 if( ci >= 0 ) // split on categorical var
3215 split = data->new_split_cat( vi, 0 );
3225 "Either 'in' or 'not_in' tags should be inside a categorical split data" );
3233 split->subset[val >> 5] |= 1 << (val & 31);
3246 split->subset[val >> 5] |= 1 << (val & 31);
3252 // instead we inverse the variable set in the split
3255 split->subset[i] ^= -1;
3260 split = data->new_split_ord( vi, 0, 0, 0, 0 );
3266 split->inversed = 1;
3269 split->ord.c = (float)cvReadReal( cmp_node );
3272 split->quality = (float)cvReadRealByName( fs, fnode, "quality" );
3276 return split;
3323 CvDTreeSplit* split;
3324 CV_CALL( split = read_split( fs, (CvFileNode*)reader.ptr ));
3326 node->split = last_split = split;
3328 last_split = last_split->next = split;
3363 if( node->split )