MultiStepLRScheduler

Models & Types ยท AiDotNet.LearningRateSchedulers

Decays the learning rate by gamma at each milestone step.

Inheritance: LearningRateSchedulerBase โ†’ MultiStepLRScheduler

For Beginners

Unlike StepLR which decays at regular intervals, MultiStepLR lets you specify exactly which steps to decay the learning rate at. For example, you might want to decay at epochs 30, 60, and 90, rather than every 30 epochs. This gives you more control over the training schedule.

How It Works

MultiStepLR decays the learning rate by gamma once the number of steps reaches one of the milestones. This allows for non-uniform decay schedules where you specify exactly when the learning rate should decrease.

This is useful when you know from experience or experimentation that certain epochs are good points to reduce the learning rate.

Example

using AiDotNet.LearningRateSchedulers;
// Decay at epochs 30, 80, and 120
var scheduler = new MultiStepLRScheduler(
    baseLearningRate: 0.1,
    milestones: new[] { 30, 80, 120 },
    gamma: 0.1
);

Constructors

Constructor Summary
MultiStepLRScheduler(double baseLearningRate, int[] milestones, double gamma, double minLearningRate) Initializes a new instance of the MultiStepLRScheduler class.

Properties

Property Summary
IReadOnlyList<int> Milestones { get; } Gets the milestones.
double Gamma { get; } Gets the multiplicative factor of learning rate decay.

Methods

Method Summary
Dictionary<string, object> GetState()