Remove unnecessary warning when 'gblinear' is selected (#3888)

This commit is contained in:
Philip Hyunsu Cho
2018-11-09 12:30:38 -08:00
committed by GitHub
parent e38d5a6831
commit be0bb7dd90

View File

@@ -187,8 +187,14 @@ class LearnerImpl : public Learner {
#endif #endif
} }
/*! \brief Map `tree_method` parameter to `updater` parameter */
void ConfigureUpdaters() { void ConfigureUpdaters() {
/* Choose updaters according to tree_method parameters */ // This method is not applicable to non-tree learners
if (cfg_.count("booster") > 0 && cfg_.at("booster") != "gbtree") {
return;
}
// `updater` parameter was manually specified
if (cfg_.count("updater") > 0) { if (cfg_.count("updater") > 0) {
LOG(CONSOLE) << "DANGER AHEAD: You have manually specified `updater` " LOG(CONSOLE) << "DANGER AHEAD: You have manually specified `updater` "
"parameter. The `tree_method` parameter will be ignored. " "parameter. The `tree_method` parameter will be ignored. "
@@ -198,6 +204,7 @@ class LearnerImpl : public Learner {
return; return;
} }
/* Choose updaters according to tree_method parameters */
switch (tparam_.tree_method) { switch (tparam_.tree_method) {
case TreeMethod::kAuto: case TreeMethod::kAuto:
// Use heuristic to choose between 'exact' and 'approx' // Use heuristic to choose between 'exact' and 'approx'
@@ -276,8 +283,6 @@ class LearnerImpl : public Learner {
cfg_["max_delta_step"] = kMaxDeltaStepDefaultValue; cfg_["max_delta_step"] = kMaxDeltaStepDefaultValue;
} }
ConfigureUpdaters();
if (cfg_.count("objective") == 0) { if (cfg_.count("objective") == 0) {
cfg_["objective"] = "reg:linear"; cfg_["objective"] = "reg:linear";
} }
@@ -285,6 +290,8 @@ class LearnerImpl : public Learner {
cfg_["booster"] = "gbtree"; cfg_["booster"] = "gbtree";
} }
ConfigureUpdaters();
if (!this->ModelInitialized()) { if (!this->ModelInitialized()) {
mparam_.InitAllowUnknown(args); mparam_.InitAllowUnknown(args);
name_obj_ = cfg_["objective"]; name_obj_ = cfg_["objective"];