_trainers#

ns_sdn.engine._internals._trainers = <module 'ns_sdn.engine._internals._trainers' from '/home/runner/work/ns-sdn/ns-sdn/src/ns_sdn/engine/_internals/_trainers.py'>[source]#

Staged full-sequence training.

One Adam optimizer per stage, one gradient per step over the whole sequence under teacher forcing, the published two-stage schedule as the default. Each step is

\[\psi \leftarrow \operatorname{Adam}_\eta\!\Bigl(\psi,\; \nabla_\psi\, \mathcal{L}\bigl(\hat y(\psi; x_{1:r}, \Delta t_{1:r}),\, y_{1:r}\bigr)\Bigr),\]

a full forward pass over the \(r\) rows the alignment laid out, the criterion of _objectives, one backward pass and one optimizer step; there is no mini-batching, no truncation of backpropagation through time, and no learning-rate schedule within a stage. The inputs and targets are built once by the predictor under the alignment: under "predicted" the input at \(t\) is \(y_{t-1}\) and the target \(y_t\), under "filtered" both are \(y_t\).

The history records the total and every unweighted part at step 0, every history_every steps and the last step of each stage, which is enough to plot a loss curve per term without storing one per step.

References

Kingma, D. P. & Ba, J. (2015). Adam: a method for stochastic optimization. ICLR.

Williams, R. J. & Zipser, D. (1989). A learning algorithm for continually running fully recurrent neural networks. Neural Computation, 1(2), 270-280. For teacher forcing.