diff --git a/docs/source/common/early_stopping.rst b/docs/source/common/early_stopping.rst index 53bafbf116..716ea922da 100644 --- a/docs/source/common/early_stopping.rst +++ b/docs/source/common/early_stopping.rst @@ -34,7 +34,7 @@ callback can be used to monitor a validation metric and stop the training when n To enable it: - Import :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping` callback. -- Log the metric you want to monitor using :func:`~~pytorch_lightning.core.lightning.LightningModule.log` method. +- Log the metric you want to monitor using :func:`~pytorch_lightning.core.lightning.LightningModule.log` method. - Init the callback, and set `monitor` to the logged metric of your choice. - Pass the :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping` callback to the :class:`~pytorch_lightning.trainer.trainer.Trainer` callbacks flag. @@ -47,7 +47,7 @@ To enable it: trainer = Trainer(callbacks=[EarlyStopping(monitor='val_loss')]) -- You can customize the callbacks behaviour by changing its parameters. +You can customize the callbacks behaviour by changing its parameters. .. testcode:: @@ -60,6 +60,15 @@ To enable it: ) trainer = Trainer(callbacks=[early_stop_callback]) + +Additional parameters that stop training at extreme points: + +- ``stopping_threshold``: Stops training immediately once the monitored quantity reaches this threshold. + It is useful when we know that going beyond a certain optimal value does not further benefit us. +- ``divergence_threshold``: Stops training as soon as the monitored quantity becomes worse than this threshold. + 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. +- ``check_finite``: When turned on, we stop training if the monitored metric becomes NaN or infinite. + In case you need early stopping in a different part of training, subclass :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping` and change where it is called: @@ -91,9 +100,3 @@ and change where it is called: .. seealso:: - :class:`~pytorch_lightning.trainer.trainer.Trainer` - :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping` - ----------- - -.. seealso:: - - :class:`~pytorch_lightning.trainer.trainer.Trainer` - - :class:`~pytorch_lightning.callbacks.early_stopping.EarlyStopping`