MetaAdaptationResult<T>
Models & Types · AiDotNet.Models.Results
Results from adapting a meta-learner to a single task.
For Beginners
Meta-learning has two phases for each task:
- Adaptation (Inner Loop): The model quickly learns from the support set (a few examples)
- Evaluation: We test on the query set (held-out examples) to see if it really learned
This result tracks:
- Support metrics: How well the model fits the training examples (should be very good)
- Query metrics: How well it generalizes (the real test!)
- Adaptation details: How many steps, how long it took, etc.
For example, in 5-way 1-shot learning:
- Support set: 5 examples (1 per class) - model adapts on these
- Query set: 15 examples (3 per class) - model is evaluated on these
- Good meta-learning: High query accuracy even with tiny support set
How It Works
This class captures detailed metrics from the inner loop adaptation process for a single task. It tracks both support set performance (where the model adapts) and query set performance (where we measure true generalization), along with adaptation details.
Constructors
| Constructor | Summary |
|---|---|
MetaAdaptationResult(T queryAccuracy, T queryLoss, T supportAccuracy, T supportLoss, int adaptationSteps, double adaptationTimeMs, List<T> perStepLosses, Dictionary<string, T> additionalMetrics) |
Initializes a new instance with adaptation metrics. |
Properties
| Property | Summary |
|---|---|
Dictionary<string, T> AdditionalMetrics { get; } |
Gets algorithm-specific metrics for this adaptation. |
List<T> PerStepLosses { get; } |
Gets the loss values recorded at each adaptation step (optional). |
T QueryAccuracy { get; } |
Gets the accuracy on the query set after adaptation. |
T QueryLoss { get; } |
Gets the loss on the query set after adaptation. |
T SupportAccuracy { get; } |
Gets the accuracy on the support set after adaptation. |
T SupportLoss { get; } |
Gets the loss on the support set after adaptation. |
double AdaptationTimeMs { get; } |
Gets the time taken for adaptation in milliseconds. |
int AdaptationSteps { get; } |
Gets the number of gradient steps taken during adaptation. |
Methods
| Method | Summary |
|---|---|
T CalculateOverfittingGap() |
Calculates the overfitting gap between support and query performance. |
bool DidConverge(double convergenceThreshold) |
Checks if the adaptation converged based on loss reduction. |
string GenerateReport() |
Generates a formatted summary of adaptation results. |