Table of Contents

Class ExponentialLRScheduler

Namespace
AiDotNet.LearningRateSchedulers
Assembly
AiDotNet.dll

Decays the learning rate exponentially every step.

public class ExponentialLRScheduler : LearningRateSchedulerBase, ILearningRateScheduler
Inheritance
ExponentialLRScheduler
Implements
Inherited Members

Examples

// Decay by 0.95 every epoch
var scheduler = new ExponentialLRScheduler(
    baseLearningRate: 0.1,
    gamma: 0.95
);

Remarks

ExponentialLR decays the learning rate by gamma every step. This provides a smooth, continuous decay that can be useful for certain training scenarios.

For Beginners: This scheduler smoothly reduces the learning rate at every step by multiplying it by a factor (gamma). Unlike StepLR which makes sudden drops, exponential decay provides a gradual, continuous reduction. Think of it like gradually releasing pressure from a gas pedal rather than making sudden brake taps.

Formula: lr = base_lr * gamma^step

Constructors

ExponentialLRScheduler(double, double, double)

Initializes a new instance of the ExponentialLRScheduler class.

public ExponentialLRScheduler(double baseLearningRate, double gamma = 0.95, double minLearningRate = 0)

Parameters

baseLearningRate double

The initial learning rate.

gamma double

Multiplicative factor of learning rate decay per step. Default: 0.95

minLearningRate double

Minimum learning rate floor. Default: 0

Exceptions

ArgumentException

Thrown when gamma is not in (0, 1].

Properties

Gamma

Gets the multiplicative factor of learning rate decay.

public double Gamma { get; }

Property Value

double

Methods

ComputeLearningRate(int)

Computes the learning rate for a given step.

protected override double ComputeLearningRate(int step)

Parameters

step int

The step number.

Returns

double

The computed learning rate.

GetState()

Gets the scheduler state for serialization/checkpointing.

public override Dictionary<string, object> GetState()

Returns

Dictionary<string, object>

A dictionary containing the scheduler state.