# View Source Axon.Schedules(Axon v0.4.1)

Parameter Schedules.

Parameter schedules are often used to anneal hyperparameters such as the learning rate during the training process. Schedules provide a mapping from the current time step to a learning rate or another hyperparameter.

Choosing a good learning rate and consequently a good learning rate schedule is typically a process of trial and error. Learning rates should be relatively small such that the learning curve does not oscillate violently during the training process, but not so small that learning proceeds too slowly. Using a schedule slowly decreases oscillations during the training process such that, as the model converges, training also becomes more stable.

All of the functions in this module are implemented as numerical functions and can be JIT or AOT compiled with any supported Nx compiler.

# Link to this section Summary

## Functions

Constant schedule.

Cosine decay schedule.

Exponential decay schedule.

Linear decay schedule.

Polynomial schedule.

# constant(init_value, opts \\ [])

View Source

Constant schedule.

$$\gamma(t) = \gamma_0$$

# cosine_decay(init_value, opts \\ [])

View Source

Cosine decay schedule.

$$\gamma(t) = \gamma_0 * \left(\frac{1}{2}(1 - \alpha)(1 + \cos\pi \frac{t}{k}) + \alpha\right)$$

## options Options

• :decay_steps - number of steps to apply decay for. $k$ in above formulation. Defaults to 10

• :alpha - minimum value of multiplier adjusting learning rate. $\alpha$ in above formulation. Defaults to 0.0

# exponential_decay(init_value, opts \\ [])

View Source

Exponential decay schedule.

$$\gamma(t) = \gamma_0 * r^{\frac{t}{k}}$$

## options Options

• :decay_rate - rate of decay. $r$ in above formulation. Defaults to 0.95

• :transition_steps - steps per transition. $k$ in above formulation. Defaults to 10

• :transition_begin - step to begin transition. Defaults to 0

• :staircase - discretize outputs. Defaults to false

# linear_decay(init_value, opts \\ [])

View Source

Linear decay schedule.

## options Options

• :warmup - scheduler warmup steps. Defaults to 0

• :steps - total number of decay steps. Defaults to 1000

# polynomial_decay(init_value, opts \\ [])

View Source

Polynomial schedule.

$$\gamma(t) = (\gamma_0 - \gamma_n) * (1 - \frac{t}{k})^p$$

## options Options

• :end_value - end value of annealed scalar. $\gamma_n$ in above formulation. Defaults to 1.0e-3

• :power - power of polynomial. $p$ in above formulation. Defaults to 2

• :transition_steps - number of steps over which annealing takes place. $k$ in above formulation. Defaults to 10