31
31
_BQML_PARAMS_MAPPING = {
32
32
"booster" : "boosterType" ,
33
33
"tree_method" : "treeMethod" ,
34
- "early_stop" : "earlyStop" ,
35
34
"colsample_bytree" : "colsampleBylevel" ,
36
35
"colsample_bylevel" : "colsampleBytree" ,
37
36
"colsample_bynode" : "colsampleBynode" ,
40
39
"reg_alpha" : "l1Regularization" ,
41
40
"reg_lambda" : "l2Regularization" ,
42
41
"learning_rate" : "learnRate" ,
43
- "min_rel_progress " : "minRelativeProgress" ,
44
- "num_parallel_tree " : "numParallelTree" ,
42
+ "tol " : "minRelativeProgress" ,
43
+ "n_estimators " : "numParallelTree" ,
45
44
"min_tree_child_weight" : "minTreeChildWeight" ,
46
45
"max_depth" : "maxTreeDepth" ,
47
46
"max_iterations" : "maxIterations" ,
@@ -57,7 +56,7 @@ class XGBRegressor(
57
56
58
57
def __init__ (
59
58
self ,
60
- num_parallel_tree : int = 1 ,
59
+ n_estimators : int = 1 ,
61
60
* ,
62
61
booster : Literal ["gbtree" , "dart" ] = "gbtree" ,
63
62
dart_normalized_type : Literal ["tree" , "forest" ] = "tree" ,
@@ -71,14 +70,13 @@ def __init__(
71
70
subsample : float = 1.0 ,
72
71
reg_alpha : float = 0.0 ,
73
72
reg_lambda : float = 1.0 ,
74
- early_stop : float = True ,
75
73
learning_rate : float = 0.3 ,
76
74
max_iterations : int = 20 ,
77
- min_rel_progress : float = 0.01 ,
75
+ tol : float = 0.01 ,
78
76
enable_global_explain : bool = False ,
79
77
xgboost_version : Literal ["0.9" , "1.1" ] = "0.9" ,
80
78
):
81
- self .num_parallel_tree = num_parallel_tree
79
+ self .n_estimators = n_estimators
82
80
self .booster = booster
83
81
self .dart_normalized_type = dart_normalized_type
84
82
self .tree_method = tree_method
@@ -91,10 +89,9 @@ def __init__(
91
89
self .subsample = subsample
92
90
self .reg_alpha = reg_alpha
93
91
self .reg_lambda = reg_lambda
94
- self .early_stop = early_stop
95
92
self .learning_rate = learning_rate
96
93
self .max_iterations = max_iterations
97
- self .min_rel_progress = min_rel_progress
94
+ self .tol = tol
98
95
self .enable_global_explain = enable_global_explain
99
96
self .xgboost_version = xgboost_version
100
97
self ._bqml_model : Optional [core .BqmlModel ] = None
@@ -127,7 +124,8 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
127
124
return {
128
125
"model_type" : "BOOSTED_TREE_REGRESSOR" ,
129
126
"data_split_method" : "NO_SPLIT" ,
130
- "num_parallel_tree" : self .num_parallel_tree ,
127
+ "early_stop" : True ,
128
+ "num_parallel_tree" : self .n_estimators ,
131
129
"booster_type" : self .booster ,
132
130
"tree_method" : self .tree_method ,
133
131
"min_tree_child_weight" : self .min_tree_child_weight ,
@@ -139,10 +137,9 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
139
137
"subsample" : self .subsample ,
140
138
"l1_reg" : self .reg_alpha ,
141
139
"l2_reg" : self .reg_lambda ,
142
- "early_stop" : self .early_stop ,
143
140
"learn_rate" : self .learning_rate ,
144
141
"max_iterations" : self .max_iterations ,
145
- "min_rel_progress" : self .min_rel_progress ,
142
+ "min_rel_progress" : self .tol ,
146
143
"enable_global_explain" : self .enable_global_explain ,
147
144
"xgboost_version" : self .xgboost_version ,
148
145
}
@@ -215,7 +212,7 @@ class XGBClassifier(
215
212
216
213
def __init__ (
217
214
self ,
218
- num_parallel_tree : int = 1 ,
215
+ n_estimators : int = 1 ,
219
216
* ,
220
217
booster : Literal ["gbtree" , "dart" ] = "gbtree" ,
221
218
dart_normalized_type : Literal ["tree" , "forest" ] = "tree" ,
@@ -229,14 +226,13 @@ def __init__(
229
226
subsample : float = 1.0 ,
230
227
reg_alpha : float = 0.0 ,
231
228
reg_lambda : float = 1.0 ,
232
- early_stop : bool = True ,
233
229
learning_rate : float = 0.3 ,
234
230
max_iterations : int = 20 ,
235
- min_rel_progress : float = 0.01 ,
231
+ tol : float = 0.01 ,
236
232
enable_global_explain : bool = False ,
237
233
xgboost_version : Literal ["0.9" , "1.1" ] = "0.9" ,
238
234
):
239
- self .num_parallel_tree = num_parallel_tree
235
+ self .n_estimators = n_estimators
240
236
self .booster = booster
241
237
self .dart_normalized_type = dart_normalized_type
242
238
self .tree_method = tree_method
@@ -249,10 +245,9 @@ def __init__(
249
245
self .subsample = subsample
250
246
self .reg_alpha = reg_alpha
251
247
self .reg_lambda = reg_lambda
252
- self .early_stop = early_stop
253
248
self .learning_rate = learning_rate
254
249
self .max_iterations = max_iterations
255
- self .min_rel_progress = min_rel_progress
250
+ self .tol = tol
256
251
self .enable_global_explain = enable_global_explain
257
252
self .xgboost_version = xgboost_version
258
253
self ._bqml_model : Optional [core .BqmlModel ] = None
@@ -285,7 +280,8 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
285
280
return {
286
281
"model_type" : "BOOSTED_TREE_CLASSIFIER" ,
287
282
"data_split_method" : "NO_SPLIT" ,
288
- "num_parallel_tree" : self .num_parallel_tree ,
283
+ "early_stop" : True ,
284
+ "num_parallel_tree" : self .n_estimators ,
289
285
"booster_type" : self .booster ,
290
286
"tree_method" : self .tree_method ,
291
287
"min_tree_child_weight" : self .min_tree_child_weight ,
@@ -297,10 +293,9 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
297
293
"subsample" : self .subsample ,
298
294
"l1_reg" : self .reg_alpha ,
299
295
"l2_reg" : self .reg_lambda ,
300
- "early_stop" : self .early_stop ,
301
296
"learn_rate" : self .learning_rate ,
302
297
"max_iterations" : self .max_iterations ,
303
- "min_rel_progress" : self .min_rel_progress ,
298
+ "min_rel_progress" : self .tol ,
304
299
"enable_global_explain" : self .enable_global_explain ,
305
300
"xgboost_version" : self .xgboost_version ,
306
301
}
@@ -371,7 +366,7 @@ class RandomForestRegressor(
371
366
372
367
def __init__ (
373
368
self ,
374
- num_parallel_tree : int = 100 ,
369
+ n_estimators : int = 100 ,
375
370
* ,
376
371
tree_method : Literal ["auto" , "exact" , "approx" , "hist" ] = "auto" ,
377
372
min_tree_child_weight : int = 1 ,
@@ -383,12 +378,11 @@ def __init__(
383
378
subsample = 0.8 ,
384
379
reg_alpha = 0.0 ,
385
380
reg_lambda = 1.0 ,
386
- early_stop = True ,
387
- min_rel_progress = 0.01 ,
381
+ tol = 0.01 ,
388
382
enable_global_explain = False ,
389
383
xgboost_version : Literal ["0.9" , "1.1" ] = "0.9" ,
390
384
):
391
- self .num_parallel_tree = num_parallel_tree
385
+ self .n_estimators = n_estimators
392
386
self .tree_method = tree_method
393
387
self .min_tree_child_weight = min_tree_child_weight
394
388
self .colsample_bytree = colsample_bytree
@@ -399,8 +393,7 @@ def __init__(
399
393
self .subsample = subsample
400
394
self .reg_alpha = reg_alpha
401
395
self .reg_lambda = reg_lambda
402
- self .early_stop = early_stop
403
- self .min_rel_progress = min_rel_progress
396
+ self .tol = tol
404
397
self .enable_global_explain = enable_global_explain
405
398
self .xgboost_version = xgboost_version
406
399
self ._bqml_model : Optional [core .BqmlModel ] = None
@@ -432,7 +425,8 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
432
425
"""The model options as they will be set for BQML"""
433
426
return {
434
427
"model_type" : "RANDOM_FOREST_REGRESSOR" ,
435
- "num_parallel_tree" : self .num_parallel_tree ,
428
+ "early_stop" : True ,
429
+ "num_parallel_tree" : self .n_estimators ,
436
430
"tree_method" : self .tree_method ,
437
431
"min_tree_child_weight" : self .min_tree_child_weight ,
438
432
"colsample_bytree" : self .colsample_bytree ,
@@ -443,8 +437,7 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
443
437
"subsample" : self .subsample ,
444
438
"l1_reg" : self .reg_alpha ,
445
439
"l2_reg" : self .reg_lambda ,
446
- "early_stop" : self .early_stop ,
447
- "min_rel_progress" : self .min_rel_progress ,
440
+ "min_rel_progress" : self .tol ,
448
441
"data_split_method" : "NO_SPLIT" ,
449
442
"enable_global_explain" : self .enable_global_explain ,
450
443
"xgboost_version" : self .xgboost_version ,
@@ -536,7 +529,7 @@ class RandomForestClassifier(
536
529
537
530
def __init__ (
538
531
self ,
539
- num_parallel_tree : int = 100 ,
532
+ n_estimators : int = 100 ,
540
533
* ,
541
534
tree_method : Literal ["auto" , "exact" , "approx" , "hist" ] = "auto" ,
542
535
min_tree_child_weight : int = 1 ,
@@ -548,12 +541,11 @@ def __init__(
548
541
subsample : float = 0.8 ,
549
542
reg_alpha : float = 0.0 ,
550
543
reg_lambda : float = 1.0 ,
551
- early_stop = True ,
552
- min_rel_progress : float = 0.01 ,
544
+ tol : float = 0.01 ,
553
545
enable_global_explain = False ,
554
546
xgboost_version : Literal ["0.9" , "1.1" ] = "0.9" ,
555
547
):
556
- self .num_parallel_tree = num_parallel_tree
548
+ self .n_estimators = n_estimators
557
549
self .tree_method = tree_method
558
550
self .min_tree_child_weight = min_tree_child_weight
559
551
self .colsample_bytree = colsample_bytree
@@ -564,8 +556,7 @@ def __init__(
564
556
self .subsample = subsample
565
557
self .reg_alpha = reg_alpha
566
558
self .reg_lambda = reg_lambda
567
- self .early_stop = early_stop
568
- self .min_rel_progress = min_rel_progress
559
+ self .tol = tol
569
560
self .enable_global_explain = enable_global_explain
570
561
self .xgboost_version = xgboost_version
571
562
self ._bqml_model : Optional [core .BqmlModel ] = None
@@ -597,7 +588,8 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
597
588
"""The model options as they will be set for BQML"""
598
589
return {
599
590
"model_type" : "RANDOM_FOREST_CLASSIFIER" ,
600
- "num_parallel_tree" : self .num_parallel_tree ,
591
+ "early_stop" : True ,
592
+ "num_parallel_tree" : self .n_estimators ,
601
593
"tree_method" : self .tree_method ,
602
594
"min_tree_child_weight" : self .min_tree_child_weight ,
603
595
"colsample_bytree" : self .colsample_bytree ,
@@ -608,8 +600,7 @@ def _bqml_options(self) -> Dict[str, str | int | bool | float | List[str]]:
608
600
"subsample" : self .subsample ,
609
601
"l1_reg" : self .reg_alpha ,
610
602
"l2_reg" : self .reg_lambda ,
611
- "early_stop" : self .early_stop ,
612
- "min_rel_progress" : self .min_rel_progress ,
603
+ "min_rel_progress" : self .tol ,
613
604
"data_split_method" : "NO_SPLIT" ,
614
605
"enable_global_explain" : self .enable_global_explain ,
615
606
"xgboost_version" : self .xgboost_version ,
0 commit comments