Learning Rate Scheduling Callback
Source:R/CallbackSetLRScheduler.R
mlr_callback_set.lr_scheduler.RdChanges the learning rate based on the schedule specified by a torch::lr_scheduler.
As of this writing, the following are available:
torch::lr_one_cycle()(where the default values forepochsandsteps_per_epochare the number of training epochs and the number of batches per epoch)Custom schedulers defined with
torch::lr_scheduler().
Super class
CallbackSet -> CallbackSetLRScheduler
Public fields
scheduler_fn(
lr_scheduler_generator)
Thetorchfunction that creates a learning rate schedulerscheduler(
LRScheduler)
The learning rate scheduler wrapped by this callback
Methods
Inherited methods
CallbackSetLRScheduler$new()
Creates a new instance of this R6 class.
Usage
CallbackSetLRScheduler$new(.scheduler, step_on_epoch, ...)Arguments
.scheduler(
lr_scheduler_generator)
Thetorchscheduler generator (e.g.torch::lr_step).step_on_epoch(
logical(1))
Whether the scheduler steps after every epoch (otherwise every batch)....(any)
The scheduler-specific initialization arguments.
CallbackSetLRScheduler$state_dict()
Returns the state of the wrapped torch scheduler, so that a later run can continue the
schedule instead of starting it over.
Returns NULL if the scheduler was not created yet, i.e. before the training loop began.
CallbackSetLRScheduler$load_state_dict()
Loads the state of the wrapped torch scheduler.
Arguments
state_dict(named
list())
The state dict as retrieved via$state_dict().