From 3b9987ca9c3950fa4643428026be43581d407eb6 Mon Sep 17 00:00:00 2001 From: Shengwen Yang Date: Fri, 30 Sep 2016 10:29:47 +0800 Subject: [PATCH] Fix the issue 1474 (#1615) * Fix 1474 * Fix crash issue when saving and loading poisson model * Rollback the wrong fix --- dmlc-core | 2 +- src/learner.cc | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dmlc-core b/dmlc-core index c5c33124d..f35f14f30 160000 --- a/dmlc-core +++ b/dmlc-core @@ -1 +1 @@ -Subproject commit c5c33124d2cc4a30ce8409d881c945c5bb04d06e +Subproject commit f35f14f30835af238257b979cc1fac3e41ff3291 diff --git a/src/learner.cc b/src/learner.cc index 508cceb46..cdf74c353 100644 --- a/src/learner.cc +++ b/src/learner.cc @@ -253,6 +253,11 @@ class LearnerImpl : public Learner { attributes_ = std::map( 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::const_iterator it = cfg_.find("max_delta_step"); + if (it != cfg_.end()) + fo->Write(it->second); + } } void UpdateOneIter(int iter, DMatrix* train) override {