Skip to content

Commit

Permalink
dump_model() bug with num_leaves=1
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Apr 29, 2019
1 parent 24ad35f commit c45ec4f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/io/tree.cpp
Expand Up @@ -506,6 +506,12 @@ Tree::Tree(const char* str, size_t* used_len) {
} else {
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; }

Expand Down Expand Up @@ -576,12 +582,6 @@ Tree::Tree(const char* str, size_t* used_len) {
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;
}

Expand Down

0 comments on commit c45ec4f

Please sign in to comment.