Table of Contents

Interface IMetaLearningAlgorithm<T, TInput, TOutput>

Namespace
AiDotNet.MetaLearning.Algorithms
Assembly
AiDotNet.dll
public interface IMetaLearningAlgorithm<T, TInput, TOutput>

Type Parameters

T
TInput
TOutput

Properties

AdaptationSteps

Gets the number of adaptation steps to perform during task adaptation.

int AdaptationSteps { get; }

Property Value

int

AlgorithmName

Gets the name of the meta-learning algorithm.

string AlgorithmName { get; }

Property Value

string

InnerLearningRate

Gets the learning rate used for task adaptation (inner loop).

double InnerLearningRate { get; }

Property Value

double

OuterLearningRate

Gets the learning rate used for meta-learning (outer loop).

double OuterLearningRate { get; }

Property Value

double

Methods

Adapt(IMetaLearningTask<T, TInput, TOutput>)

Adapts the model to a new task using its support set.

IModel<TInput, TOutput, ModelMetadata<T>> Adapt(IMetaLearningTask<T, TInput, TOutput> task)

Parameters

task IMetaLearningTask<T, TInput, TOutput>

The task to adapt to.

Returns

IModel<TInput, TOutput, ModelMetadata<T>>

A new model instance adapted to the task.

Remarks

For Beginners: This is where the "quick learning" happens. Given a new task with just a few examples (the support set), this method creates a new model that's specialized for that specific task. This is what makes meta-learning powerful - it can adapt to new tasks with very few examples.

Evaluate(TaskBatch<T, TInput, TOutput>)

Evaluates the meta-learning algorithm on a batch of tasks.

T Evaluate(TaskBatch<T, TInput, TOutput> taskBatch)

Parameters

taskBatch TaskBatch<T, TInput, TOutput>

The batch of tasks to evaluate on.

Returns

T

The average evaluation loss across all tasks.

Remarks

For Beginners: This checks how well the meta-learning algorithm performs. For each task, it adapts using the support set and then tests on the query set. The returned value is the average loss across all tasks - lower means better performance.

GetMetaModel()

Gets the base model used by this meta-learning algorithm.

IFullModel<T, TInput, TOutput> GetMetaModel()

Returns

IFullModel<T, TInput, TOutput>

The base model.

Remarks

For Beginners: This returns the "meta-learned" model that has been trained on many tasks. This model itself may not be very good at any specific task, but it's excellent as a starting point for quickly adapting to new tasks.

MetaTrain(TaskBatch<T, TInput, TOutput>)

Performs one meta-training step on a batch of tasks.

T MetaTrain(TaskBatch<T, TInput, TOutput> taskBatch)

Parameters

taskBatch TaskBatch<T, TInput, TOutput>

The batch of tasks to train on.

Returns

T

The meta-training loss for this batch.

Remarks

For Beginners: This method updates the model by training on multiple tasks at once. Each task teaches the model something about how to learn quickly. The returned loss value indicates how well the model is doing - lower is better.

SetMetaModel(IFullModel<T, TInput, TOutput>)

Sets the base model for this meta-learning algorithm.

void SetMetaModel(IFullModel<T, TInput, TOutput> model)

Parameters

model IFullModel<T, TInput, TOutput>

The model to use as the base.