Table of Contents

Interface IEpisodicDataLoader<T, TInput, TOutput>

Namespace
AiDotNet.Interfaces
Assembly
AiDotNet.dll

Interface for data loaders that provide episodic tasks for meta-learning.

public interface IEpisodicDataLoader<T, TInput, TOutput> : IDataLoader<T>, IResettable, ICountable, IBatchIterable<MetaLearningTask<T, TInput, TOutput>>

Type Parameters

T

The numeric type used for calculations, typically float or double.

TInput

The input data type for tasks.

TOutput

The output data type for tasks.

Inherited Members
Extension Methods

Remarks

This interface is for meta-learning scenarios using N-way K-shot learning, where the loader generates tasks consisting of: - Support set: K examples per class for N classes (used to adapt the model) - Query set: Additional examples for evaluation after adaptation

For Beginners: Meta-learning is "learning to learn".

Standard ML: Train on lots of cat/dog images, then classify new cat/dog images.

Meta-learning: Train on many different tasks (cats vs dogs, cars vs planes, etc.), then when given a new task with only a few examples, quickly learn to do it.

N-way K-shot means:

  • N-way: Each task has N different classes to distinguish
  • K-shot: You get K examples of each class to learn from

Example: 5-way 1-shot

  • Given 5 new animal types you've never seen
  • With only 1 example image of each
  • Classify new images into one of these 5 types

The episodic data loader creates these mini-tasks for training.

Properties

AvailableClasses

Gets the total number of available classes in the dataset.

int AvailableClasses { get; }

Property Value

int

KShot

Gets the number of support examples per class (K in K-shot).

int KShot { get; }

Property Value

int

NWay

Gets the number of classes per task (N in N-way).

int NWay { get; }

Property Value

int

QueryShots

Gets the number of query examples per class.

int QueryShots { get; }

Property Value

int

Methods

GetNextTask()

Gets the next meta-learning task (support set + query set).

MetaLearningTask<T, TInput, TOutput> GetNextTask()

Returns

MetaLearningTask<T, TInput, TOutput>

A MetaLearningTask with support and query sets.

Remarks

Each call returns a new randomly sampled task with: - N randomly selected classes from available classes - K support examples per class - QueryShots query examples per class

GetTaskBatch(int)

Gets multiple meta-learning tasks as a batch.

IReadOnlyList<MetaLearningTask<T, TInput, TOutput>> GetTaskBatch(int numTasks)

Parameters

numTasks int

Number of tasks to sample.

Returns

IReadOnlyList<MetaLearningTask<T, TInput, TOutput>>

A list of MetaLearningTasks.

SetSeed(int)

Sets the random seed for reproducible task sampling.

void SetSeed(int seed)

Parameters

seed int

Random seed value.