pycsamt.ai.plot.convergence#
Training convergence visualisation.
plot_convergence() renders training and validation loss curves
with a shaded 1-σ band (when multiple runs are provided), a vertical
marker at the early-stopping epoch, and an LR schedule indicator.
Usage#
>>> from pycsamt.ai.plot.convergence import plot_convergence
>>> fig = plot_convergence(trainer.history)
>>> fig.savefig("convergence.png", dpi=300)
Functions
|
Plot train / validation loss curves from a trainer history dict. |
|
Standalone learning-rate schedule plot. |
- pycsamt.ai.plot.convergence.plot_convergence(history, *, ax=None, log_scale=True, best_epoch=None, smoothing=0.0, show_lr=True, title='Training convergence', style=True)[source]#
Plot train / validation loss curves from a trainer history dict.
- Parameters:
history (dict or list of dict) – A dict with keys
'train_loss'and'val_loss'(and optionally'lr'), as returned byhistory. A list of such dicts (from multiple runs) activates the mean ± 1-σ band mode.ax (Axes or None) – Target axes. If
None, a new figure/axes is created.log_scale (bool) – Log₁₀ y-axis for the loss.
best_epoch (int or None) – If given, draw a vertical dashed line at this epoch.
smoothing (float in [0, 1)) – Exponential moving average smoothing coefficient. 0 = no smoothing.
show_lr (bool) – Overlay learning rate on a twin y-axis (if
'lr'in history).title (str) – Axes title.
- Returns:
fig
- Return type:
Figure