optuna.integration.FastAIV2PruningCallback
- class optuna.integration.FastAIV2PruningCallback(trial, monitor='valid_loss')[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.fitandlearn.fit_one_cycle.learn = cnn_learner(dls, resnet18, metrics=[error_rate]) learn.fit(n_epochs, cbs=[FastAIPruningCallback(trial)]) # Monitor "valid_loss" learn.fit_one_cycle( n_epochs, lr_max, cbs=[FastAIPruningCallback(trial, monitor="error_rate")], # Monitor "error_rate" )
- Parameters
trial (Trial) – A
Trialcorresponding to the current evaluation of the objective function.monitor (str) – An evaluation metric for pruning, e.g.
valid_lossoraccuracy. Please refer to fastai.callback.TrackerCallback reference for further details.
Methods
after_epoch()after_fit()