optuna.integration.FastAIPruningCallback¶
- class optuna.integration.FastAIPruningCallback(learn: Learner, trial: optuna.trial.Trial, monitor: str)[source]¶
FastAI callback to prune unpromising trials for fastai.
Note
This callback is for fastai<2.0, not the coming version developed in fastai/fastai_dev.
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.fitandlearn.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
Trialcorresponding to the current evaluation of the objective function.monitor – An evaluation metric for pruning, e.g.
valid_lossandAccuracy. Please refer to fastai.Callback reference for further details.
- __init__(learn: Learner, trial: optuna.trial.Trial, monitor: str) None[source]¶
Methods
__init__(learn, trial, monitor)on_epoch_end(epoch, **kwargs)