GEMTrainer<T, TInput, TOutput>
Models & Types · AiDotNet.ContinualLearning.Trainers
Continual learning trainer using Gradient Episodic Memory (GEM).
Inheritance: ContinualLearnerBase<T, TInput, TOutput> → GEMTrainer<T, TInput, TOutput>
For Beginners
This trainer implements continual learning using GEM, which prevents catastrophic forgetting by ensuring that gradient updates don’t increase the loss on any previous task.
How It Works
How GEM Works:
Gradient Projection Constraint:
Where α_k are solved via quadratic programming.
A-GEM Variant: Uses only the average gradient of a random subset of previous task examples, making it more efficient but potentially less effective.
Usage Example:
References:
Constructors
| Constructor | Summary |
|---|---|
GEMTrainer(IFullModel<T, TInput, TOutput> model, ILossFunction<T> lossFunction, IContinualLearnerConfig<T> config, IContinualLearningStrategy<T, TInput, TOutput> strategy) |
Initializes a new GEM trainer with default options. |
GEMTrainer(IFullModel<T, TInput, TOutput> model, ILossFunction<T> lossFunction, IContinualLearnerConfig<T> config, IContinualLearningStrategy<T, TInput, TOutput> strategy, GEMTrainerOptions<T> options) |
Initializes a new GEM trainer with custom options. |
Properties
| Property | Summary |
|---|---|
GradientEpisodicMemory<T, TInput, TOutput> GEMStrategy { get; } |
Gets the GEM-specific strategy if available. |