EpisodicDataLoaderBase<T, TInput, TOutput>
Base Classes ยท AiDotNet.Data.Loaders
Provides a base implementation for episodic data loaders with common functionality for N-way K-shot meta-learning.
Inheritance: DataLoaderBase<T> โ EpisodicDataLoaderBase<T, TInput, TOutput>
Implements: IEpisodicDataLoader<T, TInput, TOutput>
Known derived types: BalancedEpisodicDataLoader<T, TInput, TOutput>, CurriculumEpisodicDataLoader<T, TInput, TOutput>, StratifiedEpisodicDataLoader<T, TInput, TOutput>, UniformEpisodicDataLoader<T, TInput, TOutput>
For Beginners
This is the foundation that all episodic data loaders build upon.
Think of it like a template for creating meta-learning tasks:
- It handles common tasks (validating inputs, organizing data by class, checking requirements)
- Specific loaders just implement how they sample tasks
- This ensures all episodic loaders work consistently and follow SOLID principles
The base class takes care of:
- Validating that your dataset has enough classes and examples
- Building an efficient index (class to example indices) for fast sampling
- Storing configuration (N-way, K-shot, query shots)
- Providing protected access to the dataset and configuration
How It Works
This abstract class implements the IEpisodicDataLoader interface and provides common functionality for episodic task sampling. It handles dataset validation, class-to-indices preprocessing, and parameter validation while allowing derived classes to focus on implementing specific sampling strategies.
Properties
| Property | Summary |
|---|---|
bool HasNext { get; } |
|
int AvailableClasses { get; } |
|
int BatchSize { get; set; } |
|
int KShot { get; } |
|
int NWay { get; } |
|
int QueryShots { get; } |
|
int TotalCount { get; } |
|
string Description { get; } |
|
string Name { get; } |
Methods
| Method | Summary |
|---|---|
IAsyncEnumerable<MetaLearningTask<T, TInput, TOutput>> GetBatchesAsync(int? batchSize, bool shuffle, bool dropLast, int? seed, int prefetchCount, CancellationToken cancellationToken) |
|
IEnumerable<MetaLearningTask<T, TInput, TOutput>> GetBatches(int? batchSize, bool shuffle, bool dropLast, int? seed) |
|
IReadOnlyList<MetaLearningTask<T, TInput, TOutput>> GetTaskBatch(int numTasks) |
|
MetaLearningTask<T, TInput, TOutput> GetNextBatch() |
|
MetaLearningTask<T, TInput, TOutput> GetNextTask() |
|
bool TryGetNextBatch(MetaLearningTask<T, TInput, TOutput> batch) |
|
void SetSeed(int seed) |