BalancedTaskSampler<T, TInput, TOutput>
Models & Types · AiDotNet.MetaLearning.Data
Samples tasks while ensuring that all classes in the meta-dataset appear equally often across the sampled episodes over time. This prevents the meta-learner from overfitting to frequently-sampled classes.
Implements: ITaskSampler<T, TInput, TOutput>
Constructors
| Constructor | Summary |
|---|---|
BalancedTaskSampler(IMetaDataset<T, TInput, TOutput> dataset, int numWays, int numShots, int numQueryPerClass, int? seed) |
Creates a balanced task sampler that rotates through all classes evenly. |
Properties
| Property | Summary |
|---|---|
int NumQueryPerClass { get; } |
|
int NumShots { get; } |
|
int NumWays { get; } |
Methods
| Method | Summary |
|---|---|
IEpisode<T, TInput, TOutput> SampleOne() |
|
TaskBatch<T, TInput, TOutput> SampleBatch(int batchSize) |
|
void SetSeed(int seed) |
|
void UpdateWithFeedback(IReadOnlyList<IEpisode<T, TInput, TOutput>> episodes, IReadOnlyList<double> losses) |