Stage#

class ns_sdn.spectral_decomposition.Stage(learning_rate, steps, penalties=None)#

One stage of the training schedule: a fresh Adam run at one learning rate.

A schedule is a tuple of stages run in order on the same network; each constructs its own optimizer (so Adam’s moment estimates restart) and may carry its own penalty weights. The published schedule is two stages, \((\eta, \text{steps}) = (10^{-3}, 1200)\) then \((4 \times 10^{-4}, 1800)\), with heavier drift penalties in the second.

Variables:
  • learning_rate – Adam step size \(\eta\), strictly positive.

  • steps – Full-sequence gradient steps, at least one; each step is one forward pass over the whole sample and one backward pass.

  • penalties – Weights for this stage, or None to use the model’s own penalties.

Raises:

SpecificationError – If the rate is not a positive finite number, the steps are not a positive integer, or penalties is neither a record nor None.

Example

>>> from ns_sdn.spectral_decomposition import Stage, Penalties
>>> Stage(learning_rate=1e-3, steps=1200).penalties is None
True
>>> Stage(1e-3, 10, Penalties(frequency=0.0)).penalties.frequency
0.0
>>> Stage(0.0, 10)
Traceback (most recent call last):
    ...
ns_sdn.exceptions.SpecificationError: learning_rate must be strictly positive; got 0.

Attributes#