MetaOptNetOptions<T, TInput, TOutput>

Options & Configuration · AiDotNet.MetaLearning.Options

Configuration options for Meta-learning with Differentiable Convex Optimization (MetaOptNet) algorithm.

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

Implements: IMetaLearnerOptions<T>

For Beginners

In MAML, the inner loop does gradient descent: “take a step, take a step, take a step…” which can be slow and unstable. MetaOptNet says: “Why iterate? Just solve the optimal answer directly!”

How It Works

MetaOptNet replaces the gradient-based inner-loop of MAML with a differentiable convex optimization solver. Instead of taking gradient steps, it solves a closed-form optimization problem (like ridge regression or SVM) to get the classifier.

It uses mathematical formulas that give the best classifier in one shot. This is:

  • Faster: No iterative optimization
  • More stable: Convex problems have unique solutions
  • Theoretically grounded: Based on well-understood optimization theory

Reference: Lee, K., Maji, S., Ravichandran, A., & Soatto, S. (2019). Meta-Learning with Differentiable Convex Optimization. CVPR 2019.

Constructors

Constructor Summary
MetaOptNetOptions(IFullModel<T, TInput, TOutput> metaModel) Initializes a new instance of the MetaOptNetOptions class with the required meta-model.

Properties

Property Summary
ConvexSolverType SolverType { get; set; } Gets or sets the convex base learner.
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 (feature encoder) to be trained.
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 cross-entropy over logits.
bool EnableCheckpointing { get; set; } Gets or sets whether to save model checkpoints.
bool NormalizeEmbeddings { get; set; } Gets or sets whether to scale each embedding to unit length before solving.
bool UseFirstOrder { get; set; } Gets or sets whether to use first-order approximation.
bool UseLearnedTemperature { get; set; } Gets or sets whether the logit scale of eq.
double EncoderL2Regularization { get; set; } Gets or sets the L2 regularization strength for the encoder.
double InitialTemperature { get; set; } Gets or sets the starting value of the logit scale of eq.
double InnerLearningRate { get; set; } Gets or sets the learning rate for the inner loop (not used - solver is analytical).
double LabelSmoothing { get; set; } Gets or sets the label smoothing applied to the query cross-entropy.
double LogisticLambda { get; set; } Gets or sets the L2 regularization of the logistic regression base learner.
double OuterLearningRate { get; set; } Gets or sets the learning rate for the outer loop (encoder training).
double RidgeLambda { get; set; } Gets or sets lambda, the ridge regression regularization (eq.
double SolverTolerance { get; set; } Gets or sets the convergence tolerance for iterative solvers.
double SvmCost { get; set; } Gets or sets C, the SVM’s regularization parameter (eq.
double? GradientClipThreshold { get; set; } Gets or sets the maximum gradient norm for gradient clipping.
double? RegularizationStrength { get; set; } Gets or sets a regularization parameter that overrides the active solver’s own setting.
int AdaptationSteps { get; set; } Gets or sets the number of adaptation steps.
int CheckpointFrequency { get; set; } Gets or sets how often to save checkpoints.
int EmbeddingDimension { get; set; } Gets or sets the width of each example’s embedding: the embedding network’s per-example output width.
int EvaluationFrequency { get; set; } Gets or sets how often to evaluate the meta-learner.
int EvaluationTasks { get; set; } Gets or sets the number of tasks to use for evaluation.
int MaxSolverIterations { get; set; } Gets or sets the iteration budget of the iterative base learners (SVM and logistic regression).
int MetaBatchSize { get; set; } Gets or sets the number of tasks to sample per meta-training iteration.
int NumClasses { get; set; } Gets or sets the number of output classes.
int NumMetaIterations { get; set; } Gets or sets the total number of meta-training iterations.
int? RandomSeed { get; set; } Gets or sets the random seed for reproducibility.

Methods

Method Summary
IMetaLearnerOptions<T> Clone() Creates a deep copy of the MetaOptNet options.
bool IsValid() Validates that all MetaOptNet configuration options are properly set.