optuna_integration.LightGBMPruningCallback
- class optuna_integration.LightGBMPruningCallback(trial, metric, valid_name='valid_0', report_interval=1)[source]
Callback for LightGBM to prune unpromising trials.
See the example if you want to add a pruning callback which observes accuracy of a LightGBM model.
- Parameters:
trial (optuna.trial.Trial) – A
Trial
corresponding to the current evaluation of the objective function.metric (str) – An evaluation metric for pruning, e.g.,
binary_error
andmulti_error
. Please refer to LightGBM reference for further details.valid_name (str) – The name of the target validation. Validation names are specified by
valid_names
option of train method. If omitted,valid_0
is used which is the default name of the first validation. Note that this argument will be ignored if you are calling cv method instead of train method.report_interval (int) – Check if the trial should report intermediate values for pruning every n-th boosting iteration. By default
report_interval=1
and reporting is performed after every iteration. Note that the pruning itself is performed according to the interval definition of the pruner.