Implement Early Stopping to Prevent Overfitting and Optimize Training
Closes #10
Description:
This pull request implements an EarlyStopping feature to halt training when there is no significant improvement in validation loss, helping to prevent overfitting and reduce unnecessary computation.
Implementation:
Added an EarlyStopping class that monitors validation loss during training.
Introduced a patience parameter to define how many epochs to wait after the last improvement before stopping training.
Included feedback to the user about whether early stopping was triggered and at which epoch.
Key Changes:
New EarlyStopping class:
Parameters:
patience: Number of epochs to wait for validation loss improvement.
delta: Minimum change to qualify as an improvement.
Functionality: Stops training when no significant validation loss improvement is detected after the given patience period.
Training Loop Update:
Integrated the EarlyStopping callback into the training loop, checking for improvements in validation loss after each epoch.
Added logging to notify users when early stopping is activated.
Verbosity toggle:
Integrated the verbosity param into the training loop
It can toggle between showing progress bar, or printing verbose log of each epoch during training
Testing:
Manually tested the early stopping functionality on a sample model with varying patience values.
Verified that early stopping is triggered after the specified patience period without significant validation loss improvement.
Additional Notes:
Can be further enhanced to work with other metrics beyond validation loss in future iterations.
Implement Early Stopping to Prevent Overfitting and Optimize Training
Closes #10
Description:
This pull request implements an EarlyStopping feature to halt training when there is no significant improvement in validation loss, helping to prevent overfitting and reduce unnecessary computation.
Implementation:
EarlyStopping
class that monitors validation loss during training.patience
parameter to define how many epochs to wait after the last improvement before stopping training.Key Changes:
New
EarlyStopping
class:patience
: Number of epochs to wait for validation loss improvement.delta
: Minimum change to qualify as an improvement.Training Loop Update:
EarlyStopping
callback into the training loop, checking for improvements in validation loss after each epoch.Verbosity toggle:
verbosity
param into the training loopTesting:
Additional Notes: