optuna.integration.FastAIPruningCallback

class optuna.integration.FastAIPruningCallback(learn: Learner, trial: optuna.trial._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.fit and learn.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
__init__(learn: Learner, trial: optuna.trial._trial.Trial, monitor: str)None[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(learn, trial, monitor)

Initialize self.

on_epoch_end(epoch, **kwargs)