MCLOptions<T, TInput, TOutput>
Options & Configuration · AiDotNet.MetaLearning.Options
Configuration options for MCL (Meta-learning with Contrastive Learning) few-shot method.
Inheritance: ModelOptions → MCLOptions<T, TInput, TOutput>
Implements: IMetaLearnerOptions<T>
For Beginners
MCL improves features with contrastive learning:
- Standard meta-learning loss: Be good at few-shot tasks
- Contrastive loss: Same-class examples should be close, different-class far apart
- By combining both, the learned features are better organized in embedding space
Think of it as: meta-learning teaches HOW to use features for few-shot tasks, while contrastive learning teaches features to BE more useful for comparison.
How It Works
MCL combines episodic meta-learning with supervised contrastive learning to produce features that are both discriminative and well-clustered in embedding space.
Constructors
| Constructor | Summary |
|---|---|
MCLOptions(IFullModel<T, TInput, TOutput> metaModel) |
Initializes a new instance of MCLOptions. |
Properties
| Property | Summary |
|---|---|
IEpisodicDataLoader<T, TInput, TOutput> DataLoader { get; set; } |
Gets or sets the episodic data loader. |
IFullModel<T, TInput, TOutput> MetaModel { get; set; } |
Gets or sets the feature extractor model. |
IGradientBasedOptimizer<T, TInput, TOutput> InnerOptimizer { get; set; } |
Must stay null: this algorithm takes no plain gradient inner step (it adapts without one, or by its own update rule), so a supplied optimizer is rejected when the learner is built. |
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 default multi-class classification loss. |
bool EnableCheckpointing { get; set; } |
|
bool UseFirstOrder { get; set; } |
|
double ContrastiveTemperature { get; set; } |
Gets or sets the temperature for contrastive loss. |
double ContrastiveWeight { get; set; } |
Gets or sets the contrastive loss weight. |
double InnerLearningRate { get; set; } |
|
double OuterLearningRate { get; set; } |
|
double? GradientClipThreshold { get; set; } |
|
int AdaptationSteps { get; set; } |
Number of gradient steps taken on each task’s support set. |
int CheckpointFrequency { get; set; } |
|
int EvaluationFrequency { get; set; } |
|
int EvaluationTasks { get; set; } |
|
int MetaBatchSize { get; set; } |
|
int NumMetaIterations { get; set; } |
|
int NumWays { get; set; } |
Gets or sets the number of ways (classes) in the few-shot task. |
int ProjectionDim { get; set; } |
Gets or sets the projection dimension for contrastive head. |
int? RandomSeed { get; set; } |
Gets or sets the random seed. |
Methods
| Method | Summary |
|---|---|
IMetaLearnerOptions<T> Clone() |
|
bool IsValid() |