GNNMetaOptions<T, TInput, TOutput>

Options & Configuration · AiDotNet.MetaLearning.Options

Configuration options for the Graph Neural Network Meta-learning algorithm.

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

Implements: IMetaLearnerOptions<T>

For Beginners

GNN Meta-learning treats the learning process as a graph problem:

  1. Each task or example becomes a node in a graph
  2. Relationships between tasks are edges (e.g., task similarity)
  3. A graph neural network learns to propagate useful information
  4. This allows the model to leverage task relationships for better adaptation

Imagine a social network where users are tasks and friendships are similarities. By looking at what similar tasks learned, new tasks can adapt faster.

How It Works

GNN-based meta-learning models tasks and examples as nodes in a graph, with edges representing relationships between them. The graph neural network learns to propagate information across the task structure to improve learning.

Key Components:

  • Node Embeddings: Represent tasks/examples as vectors
  • Message Passing: Share information between connected nodes
  • Graph Aggregation: Combine node information for predictions

Constructors

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

Properties

Property Summary
GNNAggregationType AggregationType { get; set; } Gets or sets the aggregation method for graph-level representations.
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; } 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 meta-model’s default loss.
TaskSimilarityMetric SimilarityMetric { get; set; } Gets or sets how task similarity is computed for building the task graph.
bool EnableCheckpointing { get; set; } Gets or sets whether to save checkpoints during training.
bool LearnEdgeWeights { get; set; } Gets or sets whether to learn edge weights during training.
bool UseFirstOrder { get; set; } Gets or sets whether to use first-order approximation.
bool UseFullyConnectedGraph { get; set; } Gets or sets whether to use a fully connected task graph.
bool UseLayerNorm { get; set; } Gets or sets whether to use layer normalization in GNN layers.
bool UseResidualConnections { get; set; } Gets or sets whether to use residual connections in GNN layers.
double DropoutRate { get; set; } Gets or sets the dropout rate for GNN layers.
double EdgeThreshold { get; set; } Gets or sets the threshold for creating edges between tasks.
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-update).
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 to save checkpoints.
int EdgeFeatureDimension { get; set; } Gets or sets the dimension of edge features in the task graph.
int EvaluationFrequency { get; set; } Gets or sets how often to evaluate during meta-training.
int EvaluationTasks { get; set; } Gets or sets the number of tasks to use for evaluation.
int GNNHiddenDimension { get; set; } Gets or sets the hidden dimension for the GNN layers.
int MaxNeighbors { get; set; } Gets or sets the maximum number of neighbors per node in sparse graph.
int MetaBatchSize { get; set; } Gets or sets the number of tasks to sample per meta-training iteration.
int NodeEmbeddingDimension { get; set; } Gets or sets the dimension of node embeddings in the task graph.
int NumAttentionHeads { get; set; } Gets or sets the number of attention heads for graph attention.
int NumMessagePassingLayers { get; set; } Gets or sets the number of message passing layers in the GNN.
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 GNN Meta options.
bool IsValid() Validates that all GNN Meta configuration options are properly set.