@@ -300,6 +300,11 @@ pub struct TreeBoosterParameters {
300300 /// default: 1.0
301301 scale_pos_weight : f32 ,
302302
303+ /// Sequence of tree updaters to run, providing a modular way to construct and to modify the trees.
304+ ///
305+ /// * default: vec![]
306+ updater : Vec < TreeUpdater > ,
307+
303308 /// This is a parameter of the ‘refresh’ updater plugin. When this flag is true, tree leafs as well as tree nodes'
304309 /// stats are updated. When it is false, only node stats are updated.
305310 ///
@@ -355,6 +360,7 @@ impl Default for TreeBoosterParameters {
355360 tree_method : TreeMethod :: default ( ) ,
356361 sketch_eps : 0.03 ,
357362 scale_pos_weight : 1.0 ,
363+ updater : Vec :: new ( ) ,
358364 refresh_leaf : true ,
359365 process_type : ProcessType :: default ( ) ,
360366 grow_policy : GrowPolicy :: default ( ) ,
@@ -394,6 +400,15 @@ impl TreeBoosterParameters {
394400 v. push ( ( "num_parallel_tree" . to_owned ( ) , self . num_parallel_tree . to_string ( ) ) ) ;
395401 v. push ( ( "predictor" . to_owned ( ) , self . predictor . to_string ( ) ) ) ;
396402
403+ // Don't pass anything to XGBoost if the user didn't specify anything.
404+ // This allows XGBoost to figure it out on it's own, and suppresses the
405+ // warning message during training.
406+ // See: https://github.com/davechallis/rust-xgboost/issues/7
407+ if self . updater . len ( ) != 0
408+ {
409+ v. push ( ( "updater" . to_owned ( ) , self . updater . iter ( ) . map ( |u| u. to_string ( ) ) . collect :: < Vec < String > > ( ) . join ( "," ) ) ) ;
410+ }
411+
397412 v
398413 }
399414}
0 commit comments