ncalab.training.earlystopping ============================= .. py:module:: ncalab.training.earlystopping Classes ------- .. autoapisummary:: ncalab.training.earlystopping.EarlyStopping Module Contents --------------- .. py:class:: EarlyStopping(patience: int, min_delta: float = 1e-06) Early stopping helper class. Helps to stop the training if no change in validation metrics is observed. :param patience: Steps to wait until stopping the training. :type patience: int :param min_delta: Minimum deviation until counter is reset, defaults to 1e-6. :type min_delta: float .. py:attribute:: patience .. py:attribute:: min_delta :value: 1e-06 .. py:attribute:: best_accuracy :value: 0.0 .. py:attribute:: counter :value: 0 .. py:method:: done() -> bool Checks whether the training can be stopped. Needs to be queried in training loop, once per epoch. :returns: Whether to stop the training or not. :rtype: bool .. py:method:: step(accuracy: float) Increases internal counter if accuracy doesn't improve, otherwise resets the counter. Needs to be called in training loop, once per epoch. :param accuracy: Validation accuracy. :type accuracy: float