| 49 | } |
| 50 | |
| 51 | int Tree::Split(int leaf, int feature, int real_feature, uint32_t threshold_bin, |
| 52 | double threshold_double, double left_value, double right_value, |
| 53 | int left_cnt, int right_cnt, double left_weight, double right_weight, float gain, MissingType missing_type, bool default_left) { |
| 54 | Split(leaf, feature, real_feature, left_value, right_value, left_cnt, right_cnt, left_weight, right_weight, gain); |
| 55 | int new_node_idx = num_leaves_ - 1; |
| 56 | decision_type_[new_node_idx] = 0; |
| 57 | SetDecisionType(&decision_type_[new_node_idx], false, kCategoricalMask); |
| 58 | SetDecisionType(&decision_type_[new_node_idx], default_left, kDefaultLeftMask); |
| 59 | if (missing_type == MissingType::None) { |
| 60 | SetMissingType(&decision_type_[new_node_idx], 0); |
| 61 | } else if (missing_type == MissingType::Zero) { |
| 62 | SetMissingType(&decision_type_[new_node_idx], 1); |
| 63 | } else if (missing_type == MissingType::NaN) { |
| 64 | SetMissingType(&decision_type_[new_node_idx], 2); |
| 65 | } |
| 66 | threshold_in_bin_[new_node_idx] = threshold_bin; |
| 67 | threshold_[new_node_idx] = threshold_double; |
| 68 | ++num_leaves_; |
| 69 | return num_leaves_ - 1; |
| 70 | } |
| 71 | |
| 72 | int Tree::SplitCategorical(int leaf, int feature, int real_feature, const uint32_t* threshold_bin, int num_threshold_bin, |
| 73 | const uint32_t* threshold, int num_threshold, double left_value, double right_value, |