Class CompetenceBasedScheduler<T>
- Namespace
- AiDotNet.CurriculumLearning.Schedulers
- Assembly
- AiDotNet.dll
Curriculum scheduler that advances based on model competence/mastery.
public class CompetenceBasedScheduler<T> : CurriculumSchedulerBase<T>, ICompetenceBasedScheduler<T>, ICurriculumScheduler<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
CompetenceBasedScheduler<T>
- Implements
- Inherited Members
Remarks
For Beginners: This scheduler tracks how well the model is learning and only advances to harder content when the model has "mastered" the current difficulty level. Think of it like a tutor who won't move to harder problems until you've shown you understand the current ones.
How It Works:
- Monitor model performance metrics (accuracy, loss improvement)
- Compute a competence score based on these metrics
- When competence exceeds threshold, advance to next phase
- Include more difficult samples in each subsequent phase
Competence Metrics:
- Accuracy-Based: Uses validation/training accuracy as competence
- Loss-Based: Uses loss reduction rate as competence indicator
- Plateau-Based: Advances when loss stops improving (mastery plateau)
- Combined: Weighted combination of multiple metrics
References:
- Platanios et al. "Competence-based Curriculum Learning" (NAACL 2019)
Constructors
CompetenceBasedScheduler(int, T?, CompetenceMetricType, int, T?, T?, T?, T?, int?)
Initializes a new instance of the CompetenceBasedScheduler<T> class.
public CompetenceBasedScheduler(int totalEpochs, T? competenceThreshold = default, CompetenceMetricType metricType = CompetenceMetricType.Combined, int patienceEpochs = 5, T? minImprovement = default, T? smoothingFactor = default, T? minFraction = default, T? maxFraction = default, int? totalPhases = null)
Parameters
totalEpochsintTotal number of training epochs.
competenceThresholdTThreshold to advance to next phase (default 0.9).
metricTypeCompetenceMetricTypeType of competence metric to use.
patienceEpochsintEpochs without improvement before advancing (for plateau mode).
minImprovementTMinimum improvement to reset patience counter.
smoothingFactorTExponential smoothing factor for competence updates.
minFractionTInitial data fraction (default 0.1).
maxFractionTFinal data fraction (default 1.0).
totalPhasesint?Number of curriculum phases.
Properties
CompetenceThreshold
Gets or sets the competence threshold required to advance phases.
public T CompetenceThreshold { get; set; }
Property Value
- T
Remarks
When the model's competence exceeds this threshold, it is considered to have mastered the current content and will advance to the next phase.
CurrentCompetence
Gets the current competence level of the model.
public T CurrentCompetence { get; }
Property Value
- T
Remarks
Competence is a value typically between 0 and 1, where higher values indicate better mastery of the current curriculum content.
Name
Gets the name of this scheduler.
public override string Name { get; }
Property Value
Methods
GetDataFraction()
Gets the current data fraction based on competence-driven phase.
public override T GetDataFraction()
Returns
- T
GetStatistics()
Gets scheduler-specific statistics.
public override Dictionary<string, object> GetStatistics()
Returns
HasMasteredCurrentContent()
Gets whether the model has mastered the current curriculum content.
public bool HasMasteredCurrentContent()
Returns
- bool
True if competence exceeds threshold, false otherwise.
Reset()
Resets the scheduler to initial state.
public override void Reset()
StepEpoch(CurriculumEpochMetrics<T>)
Updates the scheduler after an epoch, potentially advancing phases.
public override bool StepEpoch(CurriculumEpochMetrics<T> epochMetrics)
Parameters
epochMetricsCurriculumEpochMetrics<T>Metrics from the completed epoch.
Returns
- bool
True if the phase advanced, false otherwise.
UpdateCompetence(CurriculumEpochMetrics<T>)
Updates the competence estimate based on model performance.
public void UpdateCompetence(CurriculumEpochMetrics<T> metrics)
Parameters
metricsCurriculumEpochMetrics<T>Performance metrics from current epoch.
Remarks
The competence update strategy depends on the configured metric type:
- Accuracy-based: Uses validation accuracy directly
- Loss-based: Converts loss improvement to competence
- Plateau-based: Tracks epochs without improvement
- Combined: Weighted average of multiple metrics