You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
early_stopping_rounds (int | None, optional): If this is specified, and an `evaluation_dataset` is passed
423
424
during fit, then an improvement in the `evaluation_metric` must be seen after at least this many
424
425
iterations of training, otherwise training will be cut short.
426
+
early_stopping_delta (float, optional): Minimum improvement in the evaluation metric
427
+
required to count as an improvement for early stopping. Defaults to 1e-7. Set to 0.0 to count any strict improvement.
425
428
initialize_base_score (bool, optional): If this is specified, the `base_score` will be calculated at fit time using the `sample_weight` and y data in accordance with the requested `objective_type`. This will result in the passed `base_score` value being overridden.
426
429
terminate_missing_features (set[Any], optional): An optional iterable of features (either strings, or integer values specifying the feature indices if numpy arrays are used for fitting), for which the missing node will always be terminated, even if `allow_missing_splits` is set to true. This value is only valid if `create_missing_branch` is also True.
427
430
missing_node_treatment (str, optional): Method for selecting the `weight` for the missing node, if `create_missing_branch` is set to `True`. Defaults to "None". Valid options are:
@@ -283,6 +291,7 @@ impl Default for GradientBooster {
283
291
GrowPolicy::DepthWise,
284
292
None,
285
293
None,
294
+
1e-7,
286
295
true,
287
296
HashSet::new(),
288
297
MissingNodeTreatment::AssignToParent,
@@ -334,6 +343,7 @@ impl GradientBooster {
334
343
/// * `sample_method` - Specify the method that records should be sampled when training?
335
344
/// * `evaluation_metric` - Define the evaluation metric to record at each iterations.
336
345
/// * `early_stopping_rounds` - Number of rounds that must
346
+
/// * `early_stopping_delta` - Minimum improvement required to reset the early stopping counter.
337
347
/// * `initialize_base_score` - If this is specified, the base_score will be calculated using the sample_weight and y data in accordance with the requested objective_type.
338
348
/// * `missing_node_treatment` - specify how missing nodes should be handled during training.
339
349
/// * `log_iterations` - Setting to a value (N) other than zero will result in information being logged about ever N iterations.
@@ -365,6 +375,7 @@ impl GradientBooster {
365
375
grow_policy:GrowPolicy,
366
376
evaluation_metric:Option<Metric>,
367
377
early_stopping_rounds:Option<usize>,
378
+
early_stopping_delta:f64,
368
379
initialize_base_score:bool,
369
380
terminate_missing_features:HashSet<usize>,
370
381
missing_node_treatment:MissingNodeTreatment,
@@ -398,6 +409,7 @@ impl GradientBooster {
398
409
grow_policy,
399
410
evaluation_metric,
400
411
early_stopping_rounds,
412
+
early_stopping_delta,
401
413
initialize_base_score,
402
414
terminate_missing_features,
403
415
evaluation_history:None,
@@ -662,7 +674,7 @@ impl GradientBooster {
662
674
// Otherwise the best could be farther back.
663
675
Some(v) => {
664
676
// We have reached a new best value...
665
-
ifis_comparison_better(v, m, maximize){
677
+
ifis_comparison_better(v, m, maximize,self.early_stopping_delta){
666
678
self.update_best_iteration(i);
667
679
Some(m)
668
680
}else{
@@ -1264,6 +1276,13 @@ impl GradientBooster {
1264
1276
self
1265
1277
}
1266
1278
1279
+
/// Set the minimum improvement delta for early stopping.
0 commit comments