Skip to content

Commit

Permalink
fix missing handle in dump_json.
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Aug 10, 2017
1 parent c4798d5 commit 4f1da35
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/io/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,19 @@ std::string Tree::NodeToJSON(int index) {
str_buf << "\"threshold\":" << Common::AvoidInf(threshold_[index]) << "," << std::endl;
str_buf << "\"decision_type\":\"<=\"," << std::endl;
}
if (GetDecisionType(decision_type_[index], kDefaultLeftMask)) {
str_buf << "\"default_left\":\"true\"," << std::endl;
} else {
str_buf << "\"default_left\":\"false\"," << std::endl;
}
uint8_t missing_type = GetMissingType(decision_type_[index]);
if (missing_type == 0) {
str_buf << "\"missing_type\":\"None\"," << std::endl;
} else if (missing_type == 1) {
str_buf << "\"missing_type\":\"Zero\"," << std::endl;
} else {
str_buf << "\"missing_type\":\"NaN\"," << std::endl;
}
str_buf << "\"internal_value\":" << internal_value_[index] << "," << std::endl;
str_buf << "\"internal_count\":" << internal_count_[index] << "," << std::endl;
str_buf << "\"left_child\":" << NodeToJSON(left_child_[index]) << "," << std::endl;
Expand Down

0 comments on commit 4f1da35

Please sign in to comment.