-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add check for NaN validation loss in EarlyStopping (#28)
This PR addresses an issue where `EarlyStopping` incorrectly treats `nan` validation losses as an improvement, often caused by exploding gradients. Key changes: - Added `np.isnan(val_loss)` check to ensure that `nan` validation losses are ignored. - Updated the logic to ensure that the patience counter and model checkpointing are unaffected by `nan` values. - Introduced a new unit test, `test_validation_loss_nan`, to verify that `EarlyStopping` behaves correctly when `nan` values are encountered during training. Closes #16
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters