optuna.integration.PyTorchLightningPruningCallback¶
-
class
optuna.integration.PyTorchLightningPruningCallback(trial: optuna.trial._trial.Trial, monitor: str)[source]¶ PyTorch Lightning callback to prune unpromising trials.
See the example if you want to add a pruning callback which observes accuracy.
- Parameters
trial – A
Trialcorresponding to the current evaluation of the objective function.monitor – An evaluation metric for pruning, e.g.,
val_lossorval_acc. The metrics are obtained from the returned dictionaries from e.g.pytorch_lightning.LightningModule.training_steporpytorch_lightning.LightningModule.validation_endand the names thus depend on how this dictionary is formatted.
-
__init__(trial: optuna.trial._trial.Trial, monitor: str) → None[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(trial, monitor)Initialize self.
on_epoch_end(trainer, pl_module)on_validation_end(trainer, pl_module)