ActiveLearningSampler<T>
Models & Types · AiDotNet.Data.Sampling
A sampler for active learning that selects the most informative samples for labeling.
Inheritance: DataSamplerBase → ActiveLearningSampler<T>
For Beginners
In active learning, you don’t have labels for all data. This sampler helps you decide which unlabeled samples to ask an expert to label:
- Uncertainty sampling: Ask about samples the model is unsure about
- Diversity sampling: Ask about samples that are different from what you’ve seen
- Expected model change: Ask about samples that would change the model most
This can dramatically reduce labeling costs (50-90% less labels needed)!
How It Works
ActiveLearningSampler implements uncertainty sampling and other active learning strategies to select unlabeled samples that would be most valuable to label.
Constructors
| Constructor | Summary |
|---|---|
ActiveLearningSampler(int datasetSize, ActiveLearningStrategy strategy, double diversityWeight, int? seed) |
Initializes a new instance of the ActiveLearningSampler class. |
Properties
| Property | Summary |
|---|---|
int LabeledCount { get; } |
Gets the number of labeled samples. |
int Length { get; } |
|
int UnlabeledCount { get; } |
Gets the number of unlabeled samples. |
Methods
| Method | Summary |
|---|---|
IEnumerable<int> SelectForLabeling(int numToSelect) |
Selects the most informative unlabeled samples for labeling. |
void MarkAsLabeled(IEnumerable<int> indices) |
Marks multiple samples as labeled. |
void MarkAsLabeled(int index) |
Marks multiple samples as labeled. |
void UpdateUncertainties(IReadOnlyList<int> indices, IReadOnlyList<T> uncertainties) |
Batch updates uncertainty scores. |
void UpdateUncertainty(int index, T uncertainty) |
Updates the uncertainty score for a sample. |