| 343 | } |
| 344 | |
| 345 | std::string Tree::CategoricalDecisionIfElse(int node) const { |
| 346 | uint8_t missing_type = GetMissingType(decision_type_[node]); |
| 347 | std::stringstream str_buf; |
| 348 | if (missing_type == 2) { |
| 349 | str_buf << "if (std::isnan(fval)) { int_fval = -1; } else { int_fval = static_cast<int>(fval); }"; |
| 350 | } else { |
| 351 | str_buf << "if (std::isnan(fval)) { int_fval = 0; } else { int_fval = static_cast<int>(fval); }"; |
| 352 | } |
| 353 | int cat_idx = static_cast<int>(threshold_[node]); |
| 354 | str_buf << "if (int_fval >= 0 && int_fval < 32 * ("; |
| 355 | str_buf << cat_boundaries_[cat_idx + 1] - cat_boundaries_[cat_idx]; |
| 356 | str_buf << ") && (((cat_threshold[" << cat_boundaries_[cat_idx]; |
| 357 | str_buf << " + int_fval / 32] >> (int_fval & 31)) & 1))) {"; |
| 358 | return str_buf.str(); |
| 359 | } |
| 360 | |
| 361 | std::string Tree::ToIfElse(int index, bool predict_leaf_index) const { |
| 362 | std::stringstream str_buf; |
nothing calls this directly
no outgoing calls
no test coverage detected