Medial Code Documentation
|
Public Member Functions | |
None | __init__ (self, int rounds, Optional[str] metric_name=None, Optional[str] data_name=None, Optional[bool] maximize=None, Optional[bool] save_best=False, float min_delta=0.0) |
_Model | before_training (self, _Model model) |
bool | after_iteration (self, _Model model, int epoch, TrainingCallback.EvalsLog evals_log) |
_Model | after_training (self, _Model model) |
![]() | |
bool | before_iteration (self, _Model model, int epoch, EvalsLog evals_log) |
Data Fields | |
data | |
metric_name | |
rounds | |
save_best | |
maximize | |
starting_round | |
current_rounds | |
Protected Member Functions | |
bool | _update_rounds (self, _Score score, str name, str metric, _Model model, int epoch) |
Protected Attributes | |
_min_delta | |
Additional Inherited Members | |
![]() | |
EvalsLog = Dict[str, Dict[str, _ScoreList]] | |
Callback function for early stopping .. versionadded:: 1.3.0 Parameters ---------- rounds : Early stopping rounds. metric_name : Name of metric that is used for early stopping. data_name : Name of dataset that is used for early stopping. maximize : Whether to maximize evaluation metric. None means auto (discouraged). save_best : Whether training should return the best model or the last model. min_delta : .. versionadded:: 1.5.0 Minimum absolute change in score to be qualified as an improvement. Examples -------- .. code-block:: python es = xgboost.callback.EarlyStopping( rounds=2, min_delta=1e-3, save_best=True, maximize=False, data_name="validation_0", metric_name="mlogloss", ) clf = xgboost.XGBClassifier(tree_method="hist", device="cuda", callbacks=[es]) X, y = load_digits(return_X_y=True) clf.fit(X, y, eval_set=[(X, y)])
None xgboost.callback.EarlyStopping.__init__ | ( | self, | |
int | rounds, | ||
Optional[str] | metric_name = None , |
||
Optional[str] | data_name = None , |
||
Optional[bool] | maximize = None , |
||
Optional[bool] | save_best = False , |
||
float | min_delta = 0.0 |
||
) |
Reimplemented from xgboost.callback.TrainingCallback.
bool xgboost.callback.EarlyStopping.after_iteration | ( | self, | |
_Model | model, | ||
int | epoch, | ||
TrainingCallback.EvalsLog | evals_log | ||
) |
Run after each iteration. Return True when training should stop.
Reimplemented from xgboost.callback.TrainingCallback.
_Model xgboost.callback.EarlyStopping.after_training | ( | self, | |
_Model | model | ||
) |
Run after training is finished.
Reimplemented from xgboost.callback.TrainingCallback.
_Model xgboost.callback.EarlyStopping.before_training | ( | self, | |
_Model | model | ||
) |
Run before training starts.
Reimplemented from xgboost.callback.TrainingCallback.