optuna.integration.AllenNLPPruningCallback¶
-
class
optuna.integration.
AllenNLPPruningCallback
(trial: Optional[optuna.trial._trial.Trial] = None, monitor: Optional[str] = None)[source]¶ AllenNLP callback to prune unpromising trials.
See the example if you want to add a proning callback which observes a metric.
You can also see the tutorial of our AllenNLP integration on AllenNLP Guide.
Note
When
AllenNLPPruningCallback
is instantiated in Python script, trial and monitor are mandatory.On the other hand, when
AllenNLPPruningCallback
is used withAllenNLPExecutor
,trial
andmonitor
would beNone
.AllenNLPExecutor
sets environment variables for a study name, trial id, monitor, and storage. ThenAllenNLPPruningCallback
loads them to restoretrial
andmonitor
.- Parameters
trial – A
Trial
corresponding to the current evaluation of the objective function.monitor – An evaluation metric for pruning, e.g.
validation_loss
orvalidation_accuracy
.
Note
Added in v2.0.0 as an experimental feature. The interface may change in newer versions without prior notice. See https://github.com/optuna/optuna/releases/tag/v2.0.0.
Methods
register
(*args, **kwargs)Stub method for EpochCallback.register.
-
classmethod
register
(*args: Any, **kwargs: Any) → Callable¶ Stub method for EpochCallback.register.
This method has the same signature as Registrable.register in AllenNLP.