Table of Contents

Class SelfPacedScheduler<T>

Namespace
AiDotNet.CurriculumLearning.Schedulers
Assembly
AiDotNet.dll

Self-paced curriculum scheduler that adapts sample selection based on model performance.

public class SelfPacedScheduler<T> : CurriculumSchedulerBase<T>, ISelfPacedScheduler<T>, ICurriculumScheduler<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
SelfPacedScheduler<T>
Implements
Inherited Members

Remarks

For Beginners: Unlike fixed schedulers, self-paced learning dynamically selects samples based on the model's current ability. Samples with loss below a threshold are considered "easy enough" and included in training. The threshold increases over time to include progressively harder samples.

How It Works:

  1. Calculate per-sample losses from the model
  2. Include samples where loss < current threshold (λ)
  3. Increase λ each epoch to include more samples
  4. Samples the model struggles with are added later

Self-Paced Regularizers:

  • Hard: Binary selection (loss < λ)
  • Linear: Weighted selection (max(0, 1 - loss/λ))
  • Mixture: Soft-hard combination for smoother transitions

References:

  • Kumar et al. "Self-Paced Learning for Latent Variable Models" (NIPS 2010)
  • Jiang et al. "Self-Paced Curriculum Learning" (AAAI 2015)

Constructors

SelfPacedScheduler(int, T?, T?, T?, SelfPaceRegularizer)

Initializes a new instance of the SelfPacedScheduler<T> class.

public SelfPacedScheduler(int totalEpochs, T? initialLambda = default, T? lambdaGrowthRate = default, T? maxLambda = default, SelfPaceRegularizer regularizer = SelfPaceRegularizer.Hard)

Parameters

totalEpochs int

Total number of training epochs.

initialLambda T

Initial pace threshold (default 0.1).

lambdaGrowthRate T

How much to increase lambda each epoch (default 0.1).

maxLambda T

Maximum lambda value (default 10.0).

regularizer SelfPaceRegularizer

Self-pace regularizer type.

Properties

CurrentThreshold

Gets the current pace threshold (lambda). Alias for PaceParameter.

public T CurrentThreshold { get; }

Property Value

T

GrowthRate

Gets or sets the growth rate for the pace parameter.

public T GrowthRate { get; set; }

Property Value

T

Remarks

Controls how quickly the pace parameter increases each epoch, determining the rate at which harder samples are introduced.

Name

Gets the name of this scheduler.

public override string Name { get; }

Property Value

string

PaceParameter

Gets or sets the current pace threshold (lambda).

public T PaceParameter { get; set; }

Property Value

T

Remarks

The pace parameter controls which samples are included in training. Samples with loss below this threshold are considered learnable.

SampleWeights

Gets sample weights from the last selection.

public Vector<T>? SampleWeights { get; }

Property Value

Vector<T>

Methods

ComputeSampleWeights(Vector<T>)

Computes sample weights based on current losses and pace threshold.

public Vector<T> ComputeSampleWeights(Vector<T> losses)

Parameters

losses Vector<T>

Per-sample losses from the model.

Returns

Vector<T>

Vector of weights for all samples (0 for excluded samples).

Remarks

This is the primary method for self-paced sample selection. Samples with loss below the current pace parameter receive positive weights, while samples above the threshold receive zero weight.

GetCurrentIndices(int[], int)

Selects samples based on difficulty scores.

public override int[] GetCurrentIndices(int[] sortedIndices, int totalSamples)

Parameters

sortedIndices int[]

Indices sorted by difficulty (easy to hard).

totalSamples int

Total number of samples.

Returns

int[]

Indices of selected samples.

GetDataFraction()

Gets the current data fraction (estimated from lambda progression).

public override T GetDataFraction()

Returns

T

GetStatistics()

Gets scheduler-specific statistics.

public override Dictionary<string, object> GetStatistics()

Returns

Dictionary<string, object>

Reset()

Resets the scheduler to initial state.

public override void Reset()

SelectSamplesWithWeights(Vector<T>)

Selects samples based on current losses and pace threshold.

public (int[] Indices, Vector<T> Weights) SelectSamplesWithWeights(Vector<T> losses)

Parameters

losses Vector<T>

Per-sample losses from the model.

Returns

(int[] Indices, Vector<T> Weights)

Indices and weights for selected samples.

StepEpoch(CurriculumEpochMetrics<T>)

Updates lambda threshold based on epoch metrics.

public override bool StepEpoch(CurriculumEpochMetrics<T> epochMetrics)

Parameters

epochMetrics CurriculumEpochMetrics<T>

Metrics from the completed epoch.

Returns

bool

True if the phase should advance, false otherwise.