Table of Contents

Class ActiveLearningOptions

Namespace
AiDotNet.Models.Options
Assembly
AiDotNet.dll

Represents configuration options for active learning.

public class ActiveLearningOptions
Inheritance
ActiveLearningOptions
Inherited Members

Remarks

For Beginners: Active learning helps when labeling data is expensive or time-consuming. Instead of randomly selecting samples to label, active learning intelligently picks the samples that would be most helpful for training the model. This can dramatically reduce the number of labels needed while achieving similar or better performance.

Typical Usage:

var options = new ActiveLearningOptions
{
    Strategy = ActiveLearningStrategyType.UncertaintySampling,
    BatchSize = 10,
    UseBatchDiversity = true
};

How to Choose a Strategy:

  • UncertaintySampling: Fast and effective for most classification tasks.
  • QueryByCommittee: Good when you have multiple models or can train an ensemble.
  • DiversitySampling: Ensures good coverage of the input space.
  • HybridSampling: Balances uncertainty and diversity.
  • BALD/BatchBALD: State-of-the-art for Bayesian neural networks.

Properties

BatchSize

Gets or sets the number of samples to select in each active learning iteration.

public int BatchSize { get; set; }

Property Value

int

Remarks

For Beginners: This controls how many samples are labeled at once. Larger batches are more efficient but may select redundant samples.

Typical values range from 1 (pure sequential) to 50-100 (batch mode).

CommitteeSize

Gets or sets the number of committee members for QueryByCommittee strategy.

public int CommitteeSize { get; set; }

Property Value

int

Remarks

More committee members provide better uncertainty estimates but require more computation. Typical values range from 3 to 10.

DensityBeta

Gets or sets the beta parameter for DensityWeightedSampling.

public double DensityBeta { get; set; }

Property Value

double

Remarks

Controls the influence of density on sample selection. Higher values give more weight to samples in dense regions.

DiversityWeight

Gets or sets the weight for diversity component in hybrid strategies.

public double DiversityWeight { get; set; }

Property Value

double

Remarks

Controls the balance between uncertainty (1 - DiversityWeight) and diversity (DiversityWeight). Values closer to 0 favor uncertainty, values closer to 1 favor diversity.

DropoutRate

Gets or sets the dropout rate for Monte Carlo Dropout in BALD/BatchBALD.

public double DropoutRate { get; set; }

Property Value

double

Remarks

The dropout rate controls the variation between forward passes. Typical values are 0.1 to 0.5.

MinimumPoolSize

Gets or sets the minimum number of samples required in the unlabeled pool.

public int MinimumPoolSize { get; set; }

Property Value

int

Remarks

Active learning stops when the pool size falls below this threshold.

NormalizeScores

Gets or sets whether to normalize informativeness scores before selection.

public bool NormalizeScores { get; set; }

Property Value

bool

Remarks

Normalization can help when combining scores from different strategies or when comparing scores across different batches.

NumClusters

Gets or sets the number of clusters for diversity-based methods.

public int NumClusters { get; set; }

Property Value

int

Remarks

Used by CoreSetSelection and DiversitySampling to group similar samples. Setting to 0 uses the batch size as the number of clusters.

NumMcSamples

Gets or sets the number of Monte Carlo samples for BALD strategy.

public int NumMcSamples { get; set; }

Property Value

int

Remarks

More samples provide better approximation of model uncertainty but increase computation. Typical values range from 5 to 20.

NumNeighbors

Gets or sets the number of nearest neighbors for density estimation.

public int NumNeighbors { get; set; }

Property Value

int

Remarks

Used by density-based methods to estimate local density around samples. Typical values range from 5 to 20.

RandomSeed

Gets or sets the random seed for reproducibility.

public int? RandomSeed { get; set; }

Property Value

int?

Remarks

Setting a seed ensures the same samples are selected across runs. Leave as null for random selection each time.

Strategy

Gets or sets the active learning strategy to use.

public ActiveLearningStrategyType Strategy { get; set; }

Property Value

ActiveLearningStrategyType

Remarks

The strategy determines how samples are selected from the unlabeled pool. Default is UncertaintySampling, which is simple and effective for most tasks.

UncertaintyMeasure

Gets or sets the uncertainty measure for UncertaintySampling strategy.

public string UncertaintyMeasure { get; set; }

Property Value

string

Remarks

Options: "LeastConfidence", "MarginSampling", "Entropy". Default is "Entropy" which considers the full probability distribution.

UseBatchDiversity

Gets or sets whether to consider diversity when selecting multiple samples in a batch.

public bool UseBatchDiversity { get; set; }

Property Value

bool

Remarks

For Beginners: When selecting multiple samples at once, enabling batch diversity ensures the selected samples are not only informative but also different from each other. This prevents selecting redundant samples that provide similar information.