MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / CategoricalDecisionIfElse

Method CategoricalDecisionIfElse

src/io/tree.cpp:345–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345std::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
361std::string Tree::ToIfElse(int index, bool predict_leaf_index) const {
362 std::stringstream str_buf;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected