Table of Contents

Class ContinualLearningResult<T>

Namespace
AiDotNet.ContinualLearning.Results
Assembly
AiDotNet.dll

Result from training on a single task in continual learning.

public class ContinualLearningResult<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
ContinualLearningResult<T>
Inherited Members

Remarks

For Beginners: This class captures everything that happened during training on one task - how well the model learned, how long it took, and whether it forgot previous knowledge.

Key Metrics Explained:

  • Training Loss: How far predictions were from targets (lower is better)
  • Training Accuracy: Percentage of correct predictions on training data
  • Average Previous Task Accuracy: How well the model still performs on old tasks
  • Forgetting: How much accuracy was lost on previous tasks (lower is better)

Reference: Parisi et al. "Continual Lifelong Learning with Neural Networks: A Review" (2019)

Constructors

ContinualLearningResult(int, T, T, T, TimeSpan, Vector<T>, Vector<T>)

Initializes a new instance of the ContinualLearningResult<T> class.

public ContinualLearningResult(int taskId, T trainingLoss, T trainingAccuracy, T averagePreviousTaskAccuracy, TimeSpan trainingTime, Vector<T> lossHistory, Vector<T> regularizationLossHistory)

Parameters

taskId int
trainingLoss T
trainingAccuracy T
averagePreviousTaskAccuracy T
trainingTime TimeSpan
lossHistory Vector<T>
regularizationLossHistory Vector<T>

Properties

AveragePreviousTaskAccuracy

Gets the average accuracy on all previously learned tasks after training on this task.

public T AveragePreviousTaskAccuracy { get; }

Property Value

T

Remarks

This is a key metric for detecting catastrophic forgetting. If this drops significantly after learning a new task, the model is forgetting.

EffectiveLearningRate

Gets the effective learning rate used (may vary with schedulers).

public T? EffectiveLearningRate { get; init; }

Property Value

T

Forgetting

Gets the amount of forgetting on previous tasks (accuracy drop).

public T? Forgetting { get; init; }

Property Value

T

Remarks

Forgetting = (accuracy before learning this task) - (accuracy after learning this task) for each previous task, averaged. Positive values indicate forgetting.

ForwardTransfer

Gets the forward transfer metric.

public T? ForwardTransfer { get; init; }

Property Value

T

Remarks

Forward transfer measures how much learning previous tasks helps with learning the current task. Positive values indicate positive transfer (prior learning helped).

GradientUpdates

Gets the number of gradient updates performed.

public int? GradientUpdates { get; init; }

Property Value

int?

LossHistory

Gets the loss history across training epochs.

public Vector<T> LossHistory { get; }

Property Value

Vector<T>

PeakMemoryBytes

Gets the peak memory usage during training in bytes.

public long? PeakMemoryBytes { get; init; }

Property Value

long?

RegularizationLossHistory

Gets the regularization loss history (e.g., EWC penalty term).

public Vector<T> RegularizationLossHistory { get; }

Property Value

Vector<T>

SampleCount

Gets the number of samples used for training.

public int? SampleCount { get; init; }

Property Value

int?

StrategyMetrics

Gets additional strategy-specific metrics.

public IReadOnlyDictionary<string, object>? StrategyMetrics { get; init; }

Property Value

IReadOnlyDictionary<string, object>

Remarks

Different strategies track different metrics: - EWC: Fisher Information norm, regularization strength - GEM: Number of gradient projections, average projection angle - LwF: Distillation loss, temperature used

TaskId

Gets the task identifier (0-indexed).

public int TaskId { get; }

Property Value

int

TrainingAccuracy

Gets the final training accuracy on this task.

public T TrainingAccuracy { get; }

Property Value

T

TrainingLoss

Gets the final training loss on this task.

public T TrainingLoss { get; }

Property Value

T

TrainingTime

Gets the time taken to train on this task.

public TimeSpan TrainingTime { get; }

Property Value

TimeSpan

ValidationAccuracy

Gets the validation accuracy on this task, if validation was performed.

public T? ValidationAccuracy { get; init; }

Property Value

T

ValidationLoss

Gets the validation loss on this task, if validation was performed.

public T? ValidationLoss { get; init; }

Property Value

T

Methods

ToString()

Returns a string representation of the training result.

public override string ToString()

Returns

string