class_docstr: A default early stopping implementation which supports stopping based on thresholds
  or based on patience-based improvement.
  
  .. versionadded:: 1.1.0
class_docstr_tok: ["A","default","early","stopping","implementation","which","supports","stopping","based","on","thresholds","or","based","on","patience-based","improvement",".","..","versionadded",":",":","1.1.0"]
docstr: Parameters
  ----------
  metric : small_text.training.metrics.Metric
      The measured training metric which will be monitored for early stopping.
  min_delta : float, default=1e-14
      The minimum absolute value to consider a change in the masured value as an
      improvement.
  patience : int, default=5
      The maximum number of steps (i.e. calls to `check_early_stop()`) which can yield no
      improvement. Disable patience-based improvement monitoring by setting patience to
      a value less than zero.
  threshold : float, default=0.0
      If greater zero, then early stopping is triggered as soon as the current measured value
      crosses ('valid_acc', 'train_acc') or falls below ('valid_loss', 'train_loss')
      the given threshold. Disable threshold-based stopping by setting the threshold to
      a value lesser than or equal zero.
docstr_tok: ["Parameters","--","--","--","--","--","metric",":","small_text.training.metrics.Metric","The","measured","training","metric","which","will","be","monitored","for","early","stopping",".","min_delta",":","float",",","default=1e-14","The","minimum","absolute","value","to","consider","a","change","in","the","masured","value","as","an","improvement",".","patience",":","int",",","default=5","The","maximum","number","of","steps","(","i.e",".","calls","to","`","check_early_stop","(",")","`",")","which","can","yield","no","improvement",".","Disable","patience-based","improvement","monitoring","by","setting","patience","to","a","value","less","than","zero",".","threshold",":","float",",","default=0.0","If","greater","zero",",","then","early","stopping","is","triggered","as","soon","as","the","current","measured","value","crosses","(","'valid_acc","'",",","'train_acc","'",")","or","falls","below","(","'valid_loss","'",",","'train_loss","'",")","the","given","threshold",".","Disable","threshold-based","stopping","by","setting","the","threshold","to","a","value","lesser","than","or","equal","zero","."]
code: def __init__(
      self, metric, min_delta=1e-14, patience=5, threshold=0.0
  ):
      """
      Parameters
      ----------
      metric : small_text.training.metrics.Metric
          The measured training metric which will be monitored for early stopping.
      min_delta : float, default=1e-14
          The minimum absolute value to consider a change in the masured value as an
          improvement.
      patience : int, default=5
          The maximum number of steps (i.e. calls to `check_early_stop()`) which can yield no
          improvement. Disable patience-based improvement monitoring by setting patience to
          a value less than zero.
      threshold : float, default=0.0
          If greater zero, then early stopping is triggered as soon as the current measured value
          crosses ('valid_acc', 'train_acc') or falls below ('valid_loss', 'train_loss')
          the given threshold. Disable threshold-based stopping by setting the threshold to
          a value lesser than or equal zero.
      """
      self._validate_arguments(metric, min_delta, patience, threshold)
  
      self._dtype = {
          "names": [
              "epoch",
              "count",
              "train_acc",
              "train_loss",
              "val_acc",
              "val_loss",
          ],
          "formats": [int, int, float, float, float, float],
      }
  
      self.metric = metric
      self.min_delta = min_delta
      self.patience = patience
      self.threshold = threshold
  
      self._index_best = -1
      self._history = np.empty((0,), dtype=self._dtype)
  
imports: import logging
  import numpy
  from abc import ABC
label_desc: Use image node_id 1 to create a new EarlyStopping object from inherited base classes: EarlyStoppingHandler with example: obj = EarlyStopping(metric, min_delta, patience, threshold)