ReptileAlgorithm<T, TInput, TOutput>
Models & Types · AiDotNet.MetaLearning.Algorithms
Implementation of the Reptile meta-learning algorithm.
Inheritance: ModelBase<T, TInput, TOutput> → MetaLearnerBase<T, TInput, TOutput> → ReptileAlgorithm<T, TInput, TOutput>
For Beginners
Reptile is like learning by averaging your experiences.
How It Works
Reptile is a simple and scalable meta-learning algorithm. Unlike MAML, it doesn’t require computing gradients through the adaptation process, making it more efficient and easier to implement while achieving competitive performance.
Algorithm:
- Sample a task (or batch of tasks)
- Perform SGD on the task starting from the current meta-parameters
- Update meta-parameters by interpolating toward the adapted parameters
- Repeat
Imagine learning to cook:
- You start with basic knowledge (initial parameters)
- You make a specific dish and learn specific techniques
- Instead of just remembering that one dish, you update your basic knowledge
to include some of what you learned
- After cooking many dishes, your basic knowledge becomes really good
for learning any new recipe quickly
Reptile is simpler than MAML because it just moves toward adapted parameters instead of computing complex gradients through the adaptation process. The key insight is that this simple approach achieves similar performance to more complex methods like MAML.
Reference: Nichol, A., Achiam, J., & Schulman, J. (2018). On first-order meta-learning algorithms.
Constructors
| Constructor | Summary |
|---|---|
ReptileAlgorithm(ReptileOptions<T, TInput, TOutput> options) |
Initializes a new instance of the ReptileAlgorithm class. |
Properties
| Property | Summary |
|---|---|
MetaLearningAlgorithmType AlgorithmType { get; } |
Gets the algorithm type identifier for this meta-learner. |
Methods
| Method | Summary |
|---|---|
IModel<TInput, TOutput, ModelMetadata<T>> Adapt(IMetaLearningTask<T, TInput, TOutput> task) |
Adapts the meta-learned model to a new task using gradient descent. |
T MetaTrain(TaskBatch<T, TInput, TOutput> taskBatch) |
Performs one meta-training step using Reptile’s parameter interpolation approach. |