class optuna.integration.XGBoostPruningCallback(trial: optuna.trial._trial.Trial, observation_key: str)[source]

Callback for XGBoost to prune unpromising trials.

See the example if you want to add a pruning callback which observes validation AUC of a XGBoost model.

  • trial – A Trial corresponding to the current evaluation of the objective function.

  • observation_key – An evaluation metric for pruning, e.g., validation-error and validation-merror. When using the Scikit-Learn API, the index number of eval_set must be included in the observation_key, e.g., validation_0-error and validation_0-merror. Please refer to eval_metric in XGBoost reference for further details.

__init__(trial: optuna.trial._trial.Trial, observation_key: str)None[source]

Initialize self. See help(type(self)) for accurate signature.


__init__(trial, observation_key)

Initialize self.