ravin-d-27 / PyDeepFlow

This is my own Deep Learning Package, optimized for performing Deep Learning Tasks and easy to learn and integrate into projects.
https://pypi.org/project/pydeepflow/
MIT License
18 stars 8 forks source link

Add Early Stopping Mechanism #33

Closed pearguacamole closed 1 month ago

pearguacamole commented 1 month ago

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:

Key Changes:

  1. 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.
  2. 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.
  3. 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:


Additional Notes:


ravin-d-27 commented 1 month ago

Hi @pearguacamole ! Thank you! Will check and merge it soon.

ravin-d-27 commented 1 month ago

Hi @pearguacamole ! Thank you for your contribution ! Please star the repository for better reach of this project !