Skip to content

Commit e4f3a8d

Browse files
authored
Update EarlyStopping docs (#7121)
1 parent 0137564 commit e4f3a8d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

docs/source/common/early_stopping.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ callback can be used to monitor a validation metric and stop the training when n
3434
To enable it:
3535

3636
- Import :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping` callback.
37-
- Log the metric you want to monitor using :func:`~~pytorch_lightning.core.lightning.LightningModule.log` method.
37+
- Log the metric you want to monitor using :func:`~pytorch_lightning.core.lightning.LightningModule.log` method.
3838
- Init the callback, and set `monitor` to the logged metric of your choice.
3939
- Pass the :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping` callback to the :class:`~pytorch_lightning.trainer.trainer.Trainer` callbacks flag.
4040

@@ -47,7 +47,7 @@ To enable it:
4747
4848
trainer = Trainer(callbacks=[EarlyStopping(monitor='val_loss')])
4949
50-
- You can customize the callbacks behaviour by changing its parameters.
50+
You can customize the callbacks behaviour by changing its parameters.
5151

5252
.. testcode::
5353

@@ -60,6 +60,15 @@ To enable it:
6060
)
6161
trainer = Trainer(callbacks=[early_stop_callback])
6262

63+
64+
Additional parameters that stop training at extreme points:
65+
66+
- ``stopping_threshold``: Stops training immediately once the monitored quantity reaches this threshold.
67+
It is useful when we know that going beyond a certain optimal value does not further benefit us.
68+
- ``divergence_threshold``: Stops training as soon as the monitored quantity becomes worse than this threshold.
69+
When reaching a value this bad, we believe the model cannot recover anymore and it is better to stop early and run with different initial conditions.
70+
- ``check_finite``: When turned on, we stop training if the monitored metric becomes NaN or infinite.
71+
6372
In case you need early stopping in a different part of training, subclass :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping`
6473
and change where it is called:
6574

@@ -91,9 +100,3 @@ and change where it is called:
91100
.. seealso::
92101
- :class:`~pytorch_lightning.trainer.trainer.Trainer`
93102
- :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping`
94-
95-
----------
96-
97-
.. seealso::
98-
- :class:`~pytorch_lightning.trainer.trainer.Trainer`
99-
- :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping`

0 commit comments

Comments
 (0)