pub enum SchedulerType {
Constant,
StepDecay {
step_size: usize,
gamma: f32,
},
Exponential {
gamma: f32,
},
CosineAnnealing {
t_max: usize,
eta_min: f32,
},
WarmupLinear {
warmup_steps: usize,
total_steps: usize,
},
ReduceOnPlateau {
factor: f32,
patience: usize,
min_lr: f32,
},
}Expand description
Learning rate scheduling strategies
Variants§
Constant
Constant learning rate throughout training
StepDecay
Step decay: multiply learning rate by gamma every step_size epochs Formula: lr = base_lr * gamma^(epoch / step_size)
Exponential
Exponential decay: multiply learning rate by gamma each epoch Formula: lr = base_lr * gamma^epoch
CosineAnnealing
Cosine annealing with warm restarts Formula: lr = eta_min + 0.5 * (base_lr - eta_min) * (1 + cos(pi * (epoch % t_max) / t_max))
WarmupLinear
Warmup phase followed by linear decay Linearly increases lr from 0 to base_lr over warmup_steps, then linearly decreases to 0 over remaining steps
ReduceOnPlateau
Reduce learning rate when a metric plateaus Useful for online learning scenarios
Trait Implementations§
Source§impl Clone for SchedulerType
impl Clone for SchedulerType
Source§fn clone(&self) -> SchedulerType
fn clone(&self) -> SchedulerType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SchedulerType
impl RefUnwindSafe for SchedulerType
impl Send for SchedulerType
impl Sync for SchedulerType
impl Unpin for SchedulerType
impl UnsafeUnpin for SchedulerType
impl UnwindSafe for SchedulerType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more