Unverified Commit c45ec4f1 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

dump_model() bug with num_leaves=1

parent 24ad35f7
...@@ -507,6 +507,12 @@ Tree::Tree(const char* str, size_t* used_len) { ...@@ -507,6 +507,12 @@ Tree::Tree(const char* str, size_t* used_len) {
Log::Fatal("Tree model string format error, should contain leaf_value field"); Log::Fatal("Tree model string format error, should contain leaf_value field");
} }
if (key_vals.count("shrinkage")) {
Common::Atof(key_vals["shrinkage"].c_str(), &shrinkage_);
} else {
shrinkage_ = 1.0f;
}
if (num_leaves_ <= 1) { return; } if (num_leaves_ <= 1) { return; }
if (key_vals.count("left_child")) { if (key_vals.count("left_child")) {
...@@ -576,12 +582,6 @@ Tree::Tree(const char* str, size_t* used_len) { ...@@ -576,12 +582,6 @@ Tree::Tree(const char* str, size_t* used_len) {
Log::Fatal("Tree model should contain cat_threshold field"); Log::Fatal("Tree model should contain cat_threshold field");
} }
} }
if (key_vals.count("shrinkage")) {
Common::Atof(key_vals["shrinkage"].c_str(), &shrinkage_);
} else {
shrinkage_ = 1.0f;
}
max_depth_ = -1; max_depth_ = -1;
} }
......
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