optuna.integration.FastAIV1PruningCallback¶
-
class
optuna.integration.
FastAIV1PruningCallback
(learn, trial, monitor)[source]¶ FastAI callback to prune unpromising trials for fastai.
Note
This callback is for fastai<2.0.
See the example if you want to add a pruning callback which monitors validation loss of a
Learner
.Example
Register a pruning callback to
learn.fit
andlearn.fit_one_cycle
.learn.fit(n_epochs, callbacks=[FastAIPruningCallback(learn, trial, "valid_loss")]) learn.fit_one_cycle( n_epochs, cyc_len, max_lr, callbacks=[FastAIPruningCallback(learn, trial, "valid_loss")], )
- Parameters
learn – fastai.basic_train.Learner.
trial – A
Trial
corresponding to the current evaluation of the objective function.monitor – An evaluation metric for pruning, e.g.
valid_loss
andAccuracy
. Please refer to fastai.callbacks.TrackerCallback reference for further details.
Warning
Deprecated in v2.4.0. This feature will be removed in the future. The removal of this feature is currently scheduled for v4.0.0, but this schedule is subject to change. See https://github.com/optuna/optuna/releases/tag/v2.4.0.
Methods
on_epoch_end
(epoch, **kwargs)