optuna.integration.FastAIV1PruningCallback
- class optuna.integration.FastAIV1PruningCallback(learn, trial, monitor)[源代码]
FastAI callback to prune unpromising trials for fastai.
备注
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
.示例
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")], )
- 参数
learn (Learner) – fastai.basic_train.Learner.
trial (optuna.trial._trial.Trial) – A
Trial
corresponding to the current evaluation of the objective function.monitor (str) – An evaluation metric for pruning, e.g.
valid_loss
andAccuracy
. Please refer to fastai.callbacks.TrackerCallback reference for further details.
- 返回类型
None
警告
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)