MAMLOptions<T, TInput, TOutput>
Options & Configuration · AiDotNet.MetaLearning.Options
Configuration options for MAML (Model-Agnostic Meta-Learning) algorithm.
Inheritance: ModelOptions → MAMLOptions<T, TInput, TOutput>
Implements: IMetaLearnerOptions<T>
For Beginners
MAML has two learning loops:
- Inner loop: Fast adaptation to a specific task (uses InnerLearningRate, AdaptationSteps)
- Outer loop: Slow learning of good initialization (uses OuterLearningRate)
How It Works
MAML learns an initialization that can be quickly fine-tuned to new tasks. These options control both the inner loop (task adaptation) and outer loop (meta-optimization).
Constructors
| Constructor | Summary |
|---|---|
MAMLOptions(IFullModel<T, TInput, TOutput> metaModel) |
Initializes a new instance of the MAMLOptions class with the required meta-model. |
Properties
| Property | Summary |
|---|---|
IEpisodicDataLoader<T, TInput, TOutput> DataLoader { get; set; } |
Gets or sets the episodic data loader for sampling tasks. |
IFullModel<T, TInput, TOutput> MetaModel { get; set; } |
Gets or sets the meta-model to be trained. |
IGradientBasedOptimizer<T, TInput, TOutput> InnerOptimizer { get; set; } |
Optimizer for task adaptation. |
IGradientBasedOptimizer<T, TInput, TOutput> MetaOptimizer { get; set; } |
Optimizer for the meta-update. |
ILossFunction<T> LossFunction { get; set; } |
Loss function for meta-training; null uses the meta-model’s default loss. |
bool EnableCheckpointing { get; set; } |
Gets or sets whether to save model checkpoints during meta-training. |
bool UseFirstOrder { get; set; } |
Gets or sets whether to use first-order approximation (FOMAML) instead of full MAML. |
bool UseFirstOrderApproximation { get; set; } |
Gets or sets whether to use first-order approximation (FOMAML). |
double InnerLearningRate { get; set; } |
Gets or sets the learning rate for the inner loop (task adaptation). |
double OuterLearningRate { get; set; } |
Gets or sets the learning rate for the outer loop (meta-optimization). |
double? GradientClipThreshold { get; set; } |
Gets or sets the maximum gradient norm for gradient clipping. |
int AdaptationSteps { get; set; } |
Gets or sets the number of gradient steps to take during inner loop adaptation. |
int CheckpointFrequency { get; set; } |
Gets or sets how often (in meta-iterations) to save checkpoints. |
int EvaluationFrequency { get; set; } |
Gets or sets how often (in meta-iterations) to evaluate the meta-learner. |
int EvaluationTasks { get; set; } |
Gets or sets the number of tasks to use for evaluation during meta-training. |
int MetaBatchSize { get; set; } |
Gets or sets the number of tasks to sample per meta-training iteration. |
int NumMetaIterations { get; set; } |
Gets or sets the total number of meta-training iterations to perform. |
int? RandomSeed { get; set; } |
Gets or sets the random seed for reproducibility. |
Methods
| Method | Summary |
|---|---|
IMetaLearnerOptions<T> Clone() |
Creates a deep copy of the MAML options. |
bool IsValid() |
Validates that all MAML configuration options are properly set. |