| |
- builtins.object
-
- lr_scheduler_exp
- lr_scheduler_plateau
- lr_scheduler_step
class lr_scheduler_exp(builtins.object) |
|
lr_scheduler_exp(optimizer, lr_decay=0.1, lr_decay_epoch=10)
Learning rate scheduler class for training neural networks.
Reduces the learning rate exponentially by lr_decay every lr_decay_epoch epochs. |
|
Methods defined here:
- __init__(self, optimizer, lr_decay=0.1, lr_decay_epoch=10)
- Initializes the scheduler with the given optimizer and learning rate decay parameters.
Args:
optimizer (Optimizer): The optimizer whose learning rate will be scheduled.
lr_decay (float, optional): The factor by which the learning rate will be multiplied at each decay step. Default is 0.1.
lr_decay_epoch (int, optional): The number of epochs after which the learning rate will be decayed. Default is 10.
- __repr__(self)
- Returns a string representation of the scheduler.
- reduce(self)
- Reduces the learning rate exponentially.
- step(self, epoch)
- Adjusts the learning rate based on the current epoch. Decays the learning rate by lr_decay every lr_decay_epoch epochs.
Args:
epoch (int): The current epoch number.
Returns: None
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class lr_scheduler_plateau(builtins.object) |
|
lr_scheduler_plateau(lr_scheduler, patience=5, threshold=0.01)
A custom learning rate scheduler that adjusts the learning rate based on the plateau of the loss function.
Args:
lr_scheduler (object): The learning rate scheduler object.
patience (int): The number of epochs to wait for improvement before reducing the learning rate. Default is 5.
threshold (float): The minimum improvement threshold required to update the best loss. Default is 0.01.
Methods:
step(loss): Updates the learning rate based on the loss value. |
|
Methods defined here:
- __init__(self, lr_scheduler, patience=5, threshold=0.01)
- Initializes the scheduler with the given learning rate scheduler, patience, and threshold.
Args:
lr_scheduler (torch.optim.lr_scheduler): The learning rate scheduler to be used.
patience (int, optional): Number of epochs to wait for improvement before taking action. Defaults to 5.
threshold (float, optional): Minimum change in the monitored value to qualify as an improvement. Defaults to 0.01.
- __repr__(self)
- Returns a string representation of the scheduler.
- step(self, epoch, loss)
- Updates the learning rate based on the loss value.
Args:
epoch (int): The current epoch number.
loss (float): The current loss value.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class lr_scheduler_step(builtins.object) |
|
lr_scheduler_step(optimizer, lr_decay=0.1, lr_decay_epoch=10)
Learning rate scheduler class for training neural networks.
Reduces the learning rate by a factor of lr_decay every lr_decay_epoch epochs.
Args:
optimizer (Optimizer): The optimizer to adjust the learning rate for.
lr_decay (float, optional): The factor to reduce the learning rate by. Defaults to 0.1.
lr_decay_epoch (int, optional): The number of epochs to wait before decaying the learning rate. Defaults to 10 |
|
Methods defined here:
- __init__(self, optimizer, lr_decay=0.1, lr_decay_epoch=10)
- Initializes the scheduler with the given optimizer and learning rate decay parameters.
Args:
optimizer (Optimizer): The optimizer whose learning rate will be scheduled.
lr_decay (float, optional): The factor by which the learning rate will be multiplied at each decay step. Default is 0.1.
lr_decay_epoch (int, optional): The number of epochs after which the learning rate will be decayed. Default is 10.
- __repr__(self)
- Returns a string representation of the scheduler.
- reduce(self)
- Reduces the learning rate by the decay factor.
- step(self, epoch)
- Adjusts the learning rate based on the current epoch. Decays the learning rate by lr_decay every lr_decay_epoch epochs.
Args:
epoch (int): The current epoch number.
Returns:
None
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
| |