Class MetaTrainingStepResult<T>
Results from a single meta-training step (one outer loop update).
public class MetaTrainingStepResult<T>
Type Parameters
TThe numeric type used for calculations (e.g., float, double, decimal).
- Inheritance
-
MetaTrainingStepResult<T>
- Inherited Members
Remarks
This class represents metrics from one iteration of meta-training, tracking the performance of a single outer loop update across a batch of tasks. It's a lightweight snapshot designed for real-time monitoring during training.
For Beginners: Think of this as the "score" for one training iteration.
Each meta-training iteration:
- Samples a batch of tasks (e.g., 4 tasks)
- Adapts to each task (inner loop)
- Updates meta-parameters based on adaptation results (outer loop)
- Returns these metrics to show how well that update performed
You'll get one of these for each iteration during training, allowing you to:
- Monitor training progress in real-time
- Log metrics to TensorBoard or similar tools
- Implement early stopping or learning rate schedules
- Debug training issues as they occur
Constructors
MetaTrainingStepResult(T, T, T, int, int, double, Dictionary<string, T>?)
Initializes a new instance with metrics from one meta-training step.
public MetaTrainingStepResult(T metaLoss, T taskLoss, T accuracy, int numTasks, int iteration, double timeMs, Dictionary<string, T>? additionalMetrics = null)
Parameters
metaLossTThe meta-loss for this step.
taskLossTThe average task-specific loss.
accuracyTThe average accuracy across tasks.
numTasksintThe number of tasks in the meta-batch.
iterationintThe iteration number.
timeMsdoubleTime taken for this step in milliseconds.
additionalMetricsDictionary<string, T>Optional algorithm-specific metrics.
Remarks
For Beginners: Call this after each meta-training step to package the results. This makes it easy to log, visualize, and monitor training progress.
Properties
Accuracy
Gets the average accuracy across tasks in this step.
public T Accuracy { get; }
Property Value
- T
The mean accuracy on query sets after adaptation, across all tasks in the batch.
AdditionalMetrics
Gets algorithm-specific metrics for this training step.
public Dictionary<string, T> AdditionalMetrics { get; }
Property Value
- Dictionary<string, T>
A dictionary of custom metrics with generic T values.
Remarks
For Production: Common additional metrics include: - "gradient_norm": Magnitude of meta-gradients - "support_accuracy": Accuracy on support sets (should be very high) - "learning_rate": Current learning rate (if using schedules) - "parameter_norm": Magnitude of model parameters
Iteration
Gets the iteration number for this training step.
public int Iteration { get; }
Property Value
- int
The sequential iteration count, useful for time-series analysis of training progress.
MetaLoss
Gets the meta-loss for this training step.
public T MetaLoss { get; }
Property Value
- T
The loss computed across all tasks in the meta-batch after inner loop adaptation. This is what the outer loop optimizes.
Remarks
For Beginners: This is the main number the meta-learner tries to minimize. Lower meta-loss means the model is getting better at adapting to new tasks quickly.
NumTasks
Gets the number of tasks processed in this meta-training step.
public int NumTasks { get; }
Property Value
- int
The meta-batch size for this iteration.
TaskLoss
Gets the average task-specific loss after adaptation.
public T TaskLoss { get; }
Property Value
- T
The mean loss across all tasks in the batch, measured on query sets after inner loop adaptation.
TimeMs
Gets the time taken for this meta-training step in milliseconds.
public double TimeMs { get; }
Property Value
- double
The elapsed time for completing this outer loop update, including all inner loop adaptations.
Methods
ToString()
Returns a concise string representation for logging.
public override string ToString()