Fix the issue 1474 (#1615)

* Fix 1474

* Fix crash issue when saving and loading poisson model

* Rollback the wrong fix
This commit is contained in:
Shengwen Yang 2016-09-30 10:29:47 +08:00 committed by Tianqi Chen
parent 3efff6d052
commit 3b9987ca9c
2 changed files with 11 additions and 1 deletions

@ -1 +1 @@
Subproject commit c5c33124d2cc4a30ce8409d881c945c5bb04d06e
Subproject commit f35f14f30835af238257b979cc1fac3e41ff3291

View File

@ -253,6 +253,11 @@ class LearnerImpl : public Learner {
attributes_ = std::map<std::string, std::string>(
attr.begin(), attr.end());
}
if (name_obj_ == "count:poisson") {
std::string max_delta_step;
fi->Read(&max_delta_step);
cfg_["max_delta_step"] = max_delta_step;
}
cfg_["num_class"] = common::ToString(mparam.num_class);
cfg_["num_feature"] = common::ToString(mparam.num_feature);
obj_->Configure(cfg_.begin(), cfg_.end());
@ -269,6 +274,11 @@ class LearnerImpl : public Learner {
attributes_.begin(), attributes_.end());
fo->Write(attr);
}
if (name_obj_ == "count:poisson") {
std::map<std::string, std::string>::const_iterator it = cfg_.find("max_delta_step");
if (it != cfg_.end())
fo->Write(it->second);
}
}
void UpdateOneIter(int iter, DMatrix* train) override {