TrainingProgress<T>

Models & Types · AiDotNet.Interfaces

A snapshot of training progress for a single completed epoch, handed to every registered ITrainingCallback so callers can plot live loss curves, stream metrics to a dashboard, or decide whether training should keep going.

For Beginners

Think of this as a single row in a training log. After every pass over your data (an “epoch”), the trainer fills one of these out and shows it to you:

  • which epoch just finished (Epoch) and how many are planned (TotalEpochs),
  • the average error for that epoch (Loss) and any extras like accuracy (Metrics),
  • how long training has been running (Elapsed) and roughly how fast it is going (StepsPerSecond).

You never construct this yourself — the framework hands it to your callback so you can watch training happen in real time.

How It Works

This is an immutable value object produced by the training loop once per epoch. It carries the epoch’s aggregate loss, any additional named metrics, and timing information so a callback can reason about both quality (is the loss falling?) and speed (how fast are epochs completing?).

Constructors

Constructor Summary
TrainingProgress(int epoch, int totalEpochs, T loss, IReadOnlyDictionary<string, T> metrics, TimeSpan elapsed, double? stepsPerSecond) Initializes a new TrainingProgress snapshot.

Properties

Property Summary
IReadOnlyDictionary<string, T> Metrics { get; } Gets any additional named metrics recorded for the epoch (e.g.
T Loss { get; } Gets the aggregate loss for the epoch (typically the mean loss across all batches).
TimeSpan Elapsed { get; } Gets the wall-clock time elapsed since training began.
double? StepsPerSecond { get; } Gets the estimated training throughput in optimizer steps per second, or null when throughput cannot be estimated.
int Epoch { get; } Gets the zero-based index of the epoch that just completed.
int TotalEpochs { get; } Gets the total number of epochs the training loop plans to run, or 0 when the count is not known in advance.