lr_shedule
cosine_decay
¶
Learning rate cosine decay function (using half of cosine curve).
This method is useful for scheduling learning rates which oscillate over time:
s = fe.schedule.LRScheduler(model=model, lr_fn=lambda step: cosine_decay(step, cycle_length=3750, init_lr=1e-3))
fe.Estimator(..., traces=[s])
For more information, check out SGDR: https://arxiv.org/pdf/1608.03983.pdf.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time |
int
|
The current step or epoch during training starting from 1. |
required |
cycle_length |
int
|
The decay cycle length. |
required |
init_lr |
float
|
Initial learning rate to decay from. |
required |
min_lr |
float
|
Minimum learning rate. |
1e-06
|
start |
int
|
The step or epoch to start the decay schedule. |
1
|
cycle_multiplier |
int
|
The factor by which next cycle length will be multiplied. |
1
|
Returns:
Name | Type | Description |
---|---|---|
lr | learning rate given current step or epoch. |