VERSAAlgorithm<T, TInput, TOutput>
Models & Types · AiDotNet.MetaLearning.Algorithms
Implementation of VERSA (Versatile and Efficient Few-shot Learning) for few-shot learning.
Inheritance: ModelBase<T, TInput, TOutput> → MetaLearnerBase<T, TInput, TOutput> → VERSAAlgorithm<T, TInput, TOutput>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
VERSA works like a “classifier factory”:
How it works:
- Feed support examples through the feature extractor to get features
- Aggregate features per class (e.g., compute class means)
- Feed aggregated features through the amortization network
- The amortization network outputs classifier weights (instantly!)
- Use those weights to classify query examples
Analogy: Imagine a car factory that can produce custom cars:
- You describe what you want (support examples)
- The factory immediately produces a car matching your specs (classifier)
- No iterative refinement needed - it’s a single manufacturing step
Compared to other methods:
- MAML: “Let me practice on these examples for 5 rounds” (iterative)
- R2-D2: “Let me solve a math equation” (closed-form but still per-task)
- VERSA: “I’ve been trained to instantly know what classifier you need” (amortized)
Key benefit: Amortization generalizes across tasks, so VERSA doesn’t need to solve each task from scratch - it recognizes patterns in support sets.
How It Works
VERSA uses an amortization network that takes aggregated support set features and produces task-specific classifier parameters in a single forward pass. No inner-loop optimization is required, making adaptation extremely fast.
Algorithm - VERSA:
Reference: Gordon, J., Bronskill, J., Bauer, M., Nowozin, S., & Turner, R. E. (2019). Meta-Learning Probabilistic Inference for Prediction. ICLR 2019.
Constructors
| Constructor | Summary |
|---|---|
VERSAAlgorithm(VERSAOptions<T, TInput, TOutput> options) |
Initializes a new VERSA meta-learner. |
Properties
| Property | Summary |
|---|---|
MetaLearningAlgorithmType AlgorithmType { get; } |
Methods
| Method | Summary |
|---|---|
IModel<TInput, TOutput, ModelMetadata<T>> Adapt(IMetaLearningTask<T, TInput, TOutput> task) |
Adapts to a new task using amortized inference (single forward pass). |
T MetaTrain(TaskBatch<T, TInput, TOutput> taskBatch) |
Performs one meta-training step for VERSA. |