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,
|
virtual std::vector<std::string> DumpModel(const FeatureMap& fmap,
|
||||||
bool with_stats,
|
bool with_stats,
|
||||||
std::string format) const = 0;
|
std::string format) = 0;
|
||||||
|
|
||||||
virtual XGBAPIThreadLocalEntry& GetThreadLocal() const = 0;
|
virtual XGBAPIThreadLocalEntry& GetThreadLocal() const = 0;
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@ -663,7 +663,6 @@ inline void XGBoostDumpModelImpl(BoosterHandle handle, const FeatureMap &fmap,
|
|||||||
auto *bst = static_cast<Learner*>(handle);
|
auto *bst = static_cast<Learner*>(handle);
|
||||||
std::vector<std::string>& str_vecs = bst->GetThreadLocal().ret_vec_str;
|
std::vector<std::string>& str_vecs = bst->GetThreadLocal().ret_vec_str;
|
||||||
std::vector<const char*>& charp_vecs = bst->GetThreadLocal().ret_vec_charp;
|
std::vector<const char*>& charp_vecs = bst->GetThreadLocal().ret_vec_charp;
|
||||||
bst->Configure();
|
|
||||||
str_vecs = bst->DumpModel(fmap, with_stats != 0, format);
|
str_vecs = bst->DumpModel(fmap, with_stats != 0, format);
|
||||||
charp_vecs.resize(str_vecs.size());
|
charp_vecs.resize(str_vecs.size());
|
||||||
for (size_t i = 0; i < str_vecs.size(); ++i) {
|
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,
|
std::vector<std::string> DumpModel(const FeatureMap& fmap,
|
||||||
bool with_stats,
|
bool with_stats,
|
||||||
std::string format) const override {
|
std::string format) override {
|
||||||
CHECK(!this->need_configuration_)
|
this->Configure();
|
||||||
<< "The model hasn't been built yet. Are you using raw Booster interface?";
|
|
||||||
return gbm_->DumpModel(fmap, with_stats, format);
|
return gbm_->DumpModel(fmap, with_stats, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user