Fix dump model. (#5485)
This commit is contained in:
parent
5fc5ec539d
commit
a9313802ea
@ -199,7 +199,7 @@ class Learner : public Model, public Configurable, public rabit::Serializable {
|
||||
*/
|
||||
virtual std::vector<std::string> DumpModel(const FeatureMap& fmap,
|
||||
bool with_stats,
|
||||
std::string format) const = 0;
|
||||
std::string format) = 0;
|
||||
|
||||
virtual XGBAPIThreadLocalEntry& GetThreadLocal() const = 0;
|
||||
/*!
|
||||
|
||||
@ -663,7 +663,6 @@ inline void XGBoostDumpModelImpl(BoosterHandle handle, const FeatureMap &fmap,
|
||||
auto *bst = static_cast<Learner*>(handle);
|
||||
std::vector<std::string>& str_vecs = bst->GetThreadLocal().ret_vec_str;
|
||||
std::vector<const char*>& charp_vecs = bst->GetThreadLocal().ret_vec_charp;
|
||||
bst->Configure();
|
||||
str_vecs = bst->DumpModel(fmap, with_stats != 0, format);
|
||||
charp_vecs.resize(str_vecs.size());
|
||||
for (size_t i = 0; i < str_vecs.size(); ++i) {
|
||||
|
||||
@ -897,9 +897,8 @@ class LearnerImpl : public LearnerIO {
|
||||
|
||||
std::vector<std::string> DumpModel(const FeatureMap& fmap,
|
||||
bool with_stats,
|
||||
std::string format) const override {
|
||||
CHECK(!this->need_configuration_)
|
||||
<< "The model hasn't been built yet. Are you using raw Booster interface?";
|
||||
std::string format) override {
|
||||
this->Configure();
|
||||
return gbm_->DumpModel(fmap, with_stats, format);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user