Table of Contents

Interface ICurriculumLearner<T, TInput, TOutput>

Namespace
AiDotNet.CurriculumLearning.Interfaces
Assembly
AiDotNet.dll

Interface for curriculum learning trainers that train models using a structured curriculum.

public interface ICurriculumLearner<T, TInput, TOutput>

Type Parameters

T

The numeric type used for calculations.

TInput

The input data type.

TOutput

The output data type.

Remarks

For Beginners: Curriculum learning is inspired by how humans learn - starting with easy examples and gradually progressing to harder ones. Just like a student learns basic arithmetic before calculus, a model trained with curriculum learning sees simple examples first, then progressively harder ones.

Why Curriculum Learning?

  • Faster convergence: Easy examples help establish basic patterns
  • Better generalization: Gradual difficulty prevents overfitting
  • Improved final accuracy: Models learn more robust representations
  • More stable training: Avoids early exposure to noisy/hard examples

Key Components:

  • Difficulty Estimator: Measures how hard each sample is
  • Curriculum Scheduler: Decides when to introduce harder samples
  • Curriculum Learner: Orchestrates the training process

References:

  • Bengio et al. "Curriculum Learning" (ICML 2009)
  • Kumar et al. "Self-Paced Learning for Latent Variable Models" (NIPS 2010)
  • Soviany et al. "Curriculum Learning: A Survey" (IJCV 2022)

Properties

BaseModel

Gets the underlying model being trained.

IFullModel<T, TInput, TOutput> BaseModel { get; }

Property Value

IFullModel<T, TInput, TOutput>

Config

Gets the configuration for the curriculum learner.

ICurriculumLearnerConfig<T> Config { get; }

Property Value

ICurriculumLearnerConfig<T>

CurrentEpoch

Gets the current epoch number.

int CurrentEpoch { get; }

Property Value

int

CurrentPhase

Gets the current training phase (0-1, where 1 means all samples are available).

T CurrentPhase { get; }

Property Value

T

DifficultyEstimator

Gets the difficulty estimator used to rank samples.

IDifficultyEstimator<T, TInput, TOutput> DifficultyEstimator { get; }

Property Value

IDifficultyEstimator<T, TInput, TOutput>

IsTraining

Gets whether training is currently in progress.

bool IsTraining { get; }

Property Value

bool

Scheduler

Gets the curriculum scheduler that controls training progression.

ICurriculumScheduler<T> Scheduler { get; }

Property Value

ICurriculumScheduler<T>

Methods

AdvancePhase()

Advances the curriculum to the next phase.

bool AdvancePhase()

Returns

bool

True if advanced, false if already at final phase.

EstimateDifficulties(IDataset<T, TInput, TOutput>)

Estimates difficulty scores for all samples in a dataset.

Vector<T> EstimateDifficulties(IDataset<T, TInput, TOutput> dataset)

Parameters

dataset IDataset<T, TInput, TOutput>

The dataset to estimate difficulties for.

Returns

Vector<T>

Vector of difficulty scores (higher = harder).

GetCurrentCurriculumIndices(Vector<T>)

Gets the indices of samples available at the current curriculum phase.

int[] GetCurrentCurriculumIndices(Vector<T> allDifficulties)

Parameters

allDifficulties Vector<T>

Difficulty scores for all samples.

Returns

int[]

Indices of samples available for training at current phase.

GetPhaseHistory()

Gets the training history.

IReadOnlyList<CurriculumPhaseResult<T>> GetPhaseHistory()

Returns

IReadOnlyList<CurriculumPhaseResult<T>>

List of results from each curriculum phase.

Load(string)

Loads the curriculum learner state.

void Load(string path)

Parameters

path string

Path to load the state from.

ResetCurriculum()

Resets the curriculum to the initial phase.

void ResetCurriculum()

Save(string)

Saves the curriculum learner state.

void Save(string path)

Parameters

path string

Path to save the state.

Train(IDataset<T, TInput, TOutput>)

Trains the model using curriculum learning.

CurriculumLearningResult<T> Train(IDataset<T, TInput, TOutput> trainingData)

Parameters

trainingData IDataset<T, TInput, TOutput>

The full training dataset.

Returns

CurriculumLearningResult<T>

Result containing training metrics and curriculum progression.

Remarks

This method will: 1. Estimate difficulty for all samples 2. Sort samples by difficulty (easy to hard) 3. Train in phases, gradually introducing harder samples 4. Track curriculum progression and model performance

Train(IDataset<T, TInput, TOutput>, IDataset<T, TInput, TOutput>)

Trains the model with a validation set for monitoring.

CurriculumLearningResult<T> Train(IDataset<T, TInput, TOutput> trainingData, IDataset<T, TInput, TOutput> validationData)

Parameters

trainingData IDataset<T, TInput, TOutput>

The full training dataset.

validationData IDataset<T, TInput, TOutput>

The validation dataset.

Returns

CurriculumLearningResult<T>

Result containing training metrics and curriculum progression.

TrainWithDifficulty(IDataset<T, TInput, TOutput>, Vector<T>)

Trains with pre-computed difficulty scores.

CurriculumLearningResult<T> TrainWithDifficulty(IDataset<T, TInput, TOutput> trainingData, Vector<T> difficultyScores)

Parameters

trainingData IDataset<T, TInput, TOutput>

The full training dataset.

difficultyScores Vector<T>

Pre-computed difficulty scores for each sample.

Returns

CurriculumLearningResult<T>

Result containing training metrics and curriculum progression.

Remarks

Use this method when: - Difficulty scores are computed externally (e.g., by domain experts) - You want to reuse difficulty scores across training runs - The difficulty estimation is too expensive to repeat

Events

PhaseCompleted

Event raised when a curriculum phase completes.

event EventHandler<CurriculumPhaseCompletedEventArgs<T>>? PhaseCompleted

Event Type

EventHandler<CurriculumPhaseCompletedEventArgs<T>>

PhaseStarted

Event raised when a curriculum phase starts.

event EventHandler<CurriculumPhaseEventArgs<T>>? PhaseStarted

Event Type

EventHandler<CurriculumPhaseEventArgs<T>>

TrainingCompleted

Event raised when training completes.

event EventHandler<CurriculumTrainingCompletedEventArgs<T>>? TrainingCompleted

Event Type

EventHandler<CurriculumTrainingCompletedEventArgs<T>>