Class CurriculumSchedulerBase<T>
- Namespace
- AiDotNet.CurriculumLearning.Schedulers
- Assembly
- AiDotNet.dll
Abstract base class for curriculum schedulers providing common functionality.
public abstract class CurriculumSchedulerBase<T> : ICurriculumScheduler<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
CurriculumSchedulerBase<T>
- Implements
- Derived
- Inherited Members
Remarks
For Beginners: A curriculum scheduler determines how the training curriculum progresses over time. It controls when and how many samples are included in training as the model advances through the curriculum.
Core Responsibilities:
- Track current training progress (epoch, phase)
- Calculate data fraction to use at each training stage
- Select samples based on difficulty scores and current progress
- Determine when curriculum is complete
Common Scheduler Types:
- Linear: Constant rate of curriculum progression
- Exponential: Starts slow, accelerates progression
- Step: Discrete jumps in curriculum phases
- Self-Paced: Adapts based on model performance
- Competence-Based: Advances when model masters current content
Constructors
CurriculumSchedulerBase(int, T?, T?, int?)
Initializes a new instance of the CurriculumSchedulerBase<T> class.
protected CurriculumSchedulerBase(int totalEpochs, T? minFraction = default, T? maxFraction = default, int? totalPhases = null)
Parameters
totalEpochsintTotal number of training epochs.
minFractionTMinimum data fraction to start with (default 0.1).
maxFractionTMaximum data fraction to end with (default 1.0).
totalPhasesint?Total number of curriculum phases (default matches epochs).
Fields
NumOps
Numeric operations for type T.
protected static readonly INumericOperations<T> NumOps
Field Value
- INumericOperations<T>
Properties
CurrentEpoch
Gets the current epoch number.
public int CurrentEpoch { get; protected set; }
Property Value
CurrentPhase
Gets the current phase as a value between 0 and 1.
public virtual T CurrentPhase { get; }
Property Value
- T
Remarks
Phase 0 means only easiest samples are available. Phase 1 means all samples are available.
CurrentPhaseNumber
Gets the current phase number (0-indexed).
public virtual int CurrentPhaseNumber { get; }
Property Value
IsComplete
Gets whether the curriculum has completed (all samples available).
public virtual bool IsComplete { get; }
Property Value
MaxFraction
Maximum data fraction to end with (usually 1.0).
protected T MaxFraction { get; }
Property Value
- T
MinFraction
Minimum data fraction to start with.
protected T MinFraction { get; }
Property Value
- T
Name
Gets the name of this scheduler.
public abstract string Name { get; }
Property Value
TotalEpochs
Total number of epochs for training.
protected int TotalEpochs { get; }
Property Value
TotalPhases
Gets the total number of phases in the curriculum.
public virtual int TotalPhases { get; }
Property Value
Methods
AdvancePhase()
Advances to the next phase.
public virtual bool AdvancePhase()
Returns
- bool
True if advanced, false if already at final phase.
GetCurrentIndices(int[], int)
Gets the indices of samples available at the current phase.
public virtual int[] GetCurrentIndices(int[] sortedIndices, int totalSamples)
Parameters
sortedIndicesint[]Indices sorted by difficulty (easy to hard).
totalSamplesintTotal number of samples.
Returns
- int[]
Indices of samples available for training.
GetDataFraction()
Gets the data fraction available at the current phase.
public abstract T GetDataFraction()
Returns
- T
Fraction of data to use (0 to 1).
GetDifficultyThreshold()
Gets the difficulty threshold for the current phase.
public virtual T GetDifficultyThreshold()
Returns
- T
Maximum difficulty score allowed in current phase.
Remarks
Default implementation returns the data fraction as the threshold, meaning samples with normalized difficulty below this value are included.
GetIndicesAtPhase(int[], int, T)
Gets the indices of samples available at a specific phase.
public virtual int[] GetIndicesAtPhase(int[] sortedIndices, int totalSamples, T phase)
Parameters
sortedIndicesint[]Indices sorted by difficulty (easy to hard).
totalSamplesintTotal number of samples.
phaseTThe phase to get indices for (0 to 1).
Returns
- int[]
Indices of samples available at the specified phase.
GetStatistics()
Gets scheduler-specific statistics.
public virtual Dictionary<string, object> GetStatistics()
Returns
- Dictionary<string, object>
Dictionary of statistics about the scheduler state.
InterpolateFraction(T)
Interpolates between min and max fraction based on progress.
protected T InterpolateFraction(T t)
Parameters
tTInterpolation parameter [0, 1].
Returns
- T
Interpolated fraction.
Reset()
Resets the scheduler to the initial phase.
public virtual void Reset()
StepEpoch(CurriculumEpochMetrics<T>)
Updates the scheduler after an epoch.
public virtual bool StepEpoch(CurriculumEpochMetrics<T> epochMetrics)
Parameters
epochMetricsCurriculumEpochMetrics<T>Metrics from the completed epoch.
Returns
- bool
True if the phase should advance, false otherwise.