Prevent training without setting up caches. (#4066)

* Prevent training without setting up caches.

* Add warning for internal functions.
* Check number of features.

* Address reviewer's comment.
This commit is contained in:
Jiaming Yuan
2019-02-03 17:03:29 +08:00
committed by Philip Hyunsu Cho
parent 7a652a8c64
commit 1088dff42c
3 changed files with 13 additions and 5 deletions

View File

@@ -703,6 +703,8 @@ class LearnerImpl : public Learner {
if (num_feature > mparam_.num_feature) {
mparam_.num_feature = num_feature;
}
CHECK_NE(mparam_.num_feature, 0)
<< "0 feature is supplied. Are you using raw Booster?";
// setup
cfg_["num_feature"] = common::ToString(mparam_.num_feature);
CHECK(obj_ == nullptr && gbm_ == nullptr);