Commit 8fd7e185 authored by wxchan's avatar wxchan Committed by Guolin Ke
Browse files

fix dump tree (#465)

parent 567f63ec
...@@ -329,7 +329,11 @@ std::string Tree::ToJSON() { ...@@ -329,7 +329,11 @@ std::string Tree::ToJSON() {
str_buf << "\"num_leaves\":" << num_leaves_ << "," << std::endl; str_buf << "\"num_leaves\":" << num_leaves_ << "," << std::endl;
str_buf << "\"shrinkage\":" << shrinkage_ << "," << std::endl; str_buf << "\"shrinkage\":" << shrinkage_ << "," << std::endl;
str_buf << "\"has_categorical\":" << (has_categorical_ ? 1 : 0) << "," << std::endl; str_buf << "\"has_categorical\":" << (has_categorical_ ? 1 : 0) << "," << std::endl;
str_buf << "\"tree_structure\":" << NodeToJSON(0) << std::endl; if (num_leaves_ == 1) {
str_buf << "\"tree_structure\":" << NodeToJSON(-1) << std::endl;
} else {
str_buf << "\"tree_structure\":" << NodeToJSON(0) << std::endl;
}
return str_buf.str(); return str_buf.str();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment