Skip to content

← deep_learning package

CyclicCosineDecaySchedule

A cyclic linear warmup followed by cosine decay schedule.

This is essentially a repeated application of the "Linear warmup cosine decay" schedule, where each parameter is a list of values, one for each cycle. See also the "Linear Warmup Cosine Decay Schedule" schedule node for how a single cycle behaves. This schedule is more commonly known as the SGDR (SGD with Restarts) schedule, following a paper by Lochilov and Hutter, 2017 (see also URL). The basic idea is that the optimization can get stuck in a local optimum, and the subsequent cycle can "shake out" the current solution from that optimum and find a better one. Schedule nodes in NeuroPype are used for fine-grained control over how parameters, like the learning rate, should change over time during optimization. Most Step nodes offer a learning_rate_schedule port, into which a Schedule node can be wired to override the otherwise default constant learning rate. However, any other optimizer step parameter can be controlled by a schedule, simply by wiring the schedule node's output into the respective parameter of the Step nodes, and passing the schedule the current iteration (step) count of the optimization process. More Info... Version 0.2.0

Ports/Properties

step

Current step (iteration) count.

verbose name
Step
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

value

Schedule value at current step count.

verbose name
Value
default value
None
port type
DataPort
value type
object (can be None)
data direction
OUT

init_values

Initial parameter values. This is the initial value at the beginning of each successive cycle.

verbose name
Cycle Initial Values
default value
[0.0]
port type
ListPort
value type
list

peak_values

Peak parameter values. This is the value at the peak following the initial warmup, before it is lowered again following a cosine function, for each cycle.

verbose name
Peak Values
default value
[1.0]
port type
ListPort
value type
list (can be None)

final_values

Final parameter values. The cosine decay reduces the value from the peak down to the final value; given for each cycle.

verbose name
Cycle Final Values
default value
[0.0]
port type
ListPort
value type
list

warmup_steps

Number of steps over which to ramp up from the initial value to the peak value. After this, the parameter is lowered again following the shape of a cosine function down to the desired final value value; given for each cycle.

verbose name
Cycle Warmup Steps
default value
[100]
port type
ListPort
value type
list (can be None)

decay_steps

The number of steps over which the cosine decay takes place. This is a soft transition following a raised- cosine function from the peak value down to the final value; given for each cycle.

verbose name
Cycle Decay Steps
default value
[100]
port type
ListPort
value type
list (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)

step_multiplier

Multiplier for the step count. This value is multiplied with each of the step counts to uniformly speed up or slow down the schedule through a single parameter. When used to define an optimizer used by the DeepModel node, this can also be set to 0.0, in which case the multiplier is chosen such that the schedule reaches its final value at the end of the training process, but note that this is not always possible, namely for schedules that are never reach a final value. Otherwise, to make a schedule dependent on the number of steps done by a node, you may normalize your schedule to eg 1000 steps and then wire a formula that calculates the steps done by some process divided by 1000 into this node.

verbose name
Step Multiplier
default value
1.0
port type
FloatPort
value type
float (can be None)