SetFeatOptions<T, TInput, TOutput>

Options & Configuration · AiDotNet.MetaLearning.Options

Configuration options for SetFeat (set-feature based few-shot learning) (Afrasiyabi et al., CVPR 2022).

Inheritance: ModelOptions → SetFeatOptions<T, TInput, TOutput>

Implements: IMetaLearnerOptions<T>

For Beginners

SetFeat treats each class as a SET, not just a point:

  • ProtoNets: Each class = average of its examples (one point)
  • SetFeat: Each class = rich representation capturing variety across examples

This helps because knowing HOW a class varies (e.g., small vs. large dogs) is as important as knowing the class average.

How It Works

SetFeat learns set-level features by processing each class’s support examples as a set rather than individual instances. A set encoder computes class representations that capture intra-class variation, not just the class mean.

Reference: Afrasiyabi, A., Larochelle, H., Lalonde, J.F., & Gagne, C. (2022). Matching Feature Sets for Few-Shot Image Classification. CVPR 2022.

Constructors

Constructor Summary
SetFeatOptions(IFullModel<T, TInput, TOutput> metaModel) Initializes a new instance of SetFeatOptions.

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 UseCrossAttention { get; set; } Gets or sets whether to use cross-attention between support sets.
bool UseFirstOrder { get; set; }
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 SetEncoderDim { get; set; } Gets or sets the set encoder dimension.
int? RandomSeed { get; set; } Gets or sets the random seed.

Methods

Method Summary
IMetaLearnerOptions<T> Clone()
bool IsValid()