@@ -187,8 +187,14 @@ class LearnerImpl : public Learner {
187
187
#endif
188
188
}
189
189
190
+
191
+ /* ! \brief Map `tree_method` parameter to `updater` parameter */
190
192
void ConfigureUpdaters () {
191
- /* Choose updaters according to tree_method parameters */
193
+ // This method is not applicable to non-tree learners
194
+ if (cfg_.count (" booster" ) > 0 && cfg_.at (" booster" ) != " gbtree" ) {
195
+ return ;
196
+ }
197
+ // `updater` parameter was manually specified
192
198
if (cfg_.count (" updater" ) > 0 ) {
193
199
LOG (CONSOLE) << " DANGER AHEAD: You have manually specified `updater` "
194
200
" parameter. The `tree_method` parameter will be ignored. "
@@ -198,6 +204,7 @@ class LearnerImpl : public Learner {
198
204
return ;
199
205
}
200
206
207
+ /* Choose updaters according to tree_method parameters */
201
208
switch (tparam_.tree_method ) {
202
209
case TreeMethod::kAuto :
203
210
// Use heuristic to choose between 'exact' and 'approx'
@@ -276,15 +283,15 @@ class LearnerImpl : public Learner {
276
283
cfg_[" max_delta_step" ] = kMaxDeltaStepDefaultValue ;
277
284
}
278
285
279
- ConfigureUpdaters ();
280
-
281
286
if (cfg_.count (" objective" ) == 0 ) {
282
287
cfg_[" objective" ] = " reg:linear" ;
283
288
}
284
289
if (cfg_.count (" booster" ) == 0 ) {
285
290
cfg_[" booster" ] = " gbtree" ;
286
291
}
287
292
293
+ ConfigureUpdaters ();
294
+
288
295
if (!this ->ModelInitialized ()) {
289
296
mparam_.InitAllowUnknown (args);
290
297
name_obj_ = cfg_[" objective" ];
0 commit comments