core.utils.trainutils.EarlyStopping
core.utils.trainutils.EarlyStopping(
patience=5,
verbose=False,
delta=0.0,
metric='validation',
)Implement early stopping during training, once the validation loss stops decreasing for a certain number of epochs (the patience).
If val_loss > min_val_loss - delta for more than patience epochs, then returns early stopping occurs.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| patience | int | Number of epochs to wait before stopping. | 5 |
| verbose | bool | Whether to print counter increments. | False |
| delta | float | Amount by which loss must decrease in patience epochs. | 0.0 |
| metric | Literal['training', 'validation'] | Whether to use the training loss to determine early stopping (“training”) or the test loss (“validation”) | 'validation' |
Attributes
| Name | Description |
|---|---|
| best_score | |
| counter | |
| delta | |
| early_stop | |
| metric | |
| patience | |
| val_loss_min | |
| verbose |