Skip to content

Commit

Permalink
Merge pull request dmlc#3 from headupinclouds/pr.must.return.value
Browse files Browse the repository at this point in the history
Rturn value in {GBLinear,GBTree}::DumpModel() even on assert(false)
  • Loading branch information
headupinclouds committed Sep 25, 2016
2 parents c92ac40 + 1b10312 commit 831ef30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/gbm/gblinear-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class GBLinear : public IGradBooster {
utils::Error("gblinear does not support predict leaf index");
}
virtual std::vector<std::string> DumpModel(const utils::FeatMap& fmap, int option) {
std::vector<std::string> v;
#if XGBOOST_DO_LEAN
assert(false);
#else
Expand All @@ -195,10 +196,9 @@ class GBLinear : public IGradBooster {
fo << model[i][j] << std::endl;
}
}
std::vector<std::string> v;
v.push_back(fo.str());
#endif
return v;
#endif
}

protected:
Expand Down
6 changes: 3 additions & 3 deletions src/gbm/gbtree-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ class GBTree : public IGradBooster {
#endif
}
virtual std::vector<std::string> DumpModel(const utils::FeatMap& fmap, int option) {
std::vector<std::string> dump;
#if XGBOOST_DO_LEAN
assert(false);
#else
std::vector<std::string> dump;
#else
for (size_t i = 0; i < trees.size(); i++) {
dump.push_back(trees[i]->DumpModel(fmap, option&1));
}
#endif
return dump;
#endif
}

protected:
Expand Down

0 comments on commit 831ef30

Please sign in to comment.