class_docstr: Early stopping on plateau helper.
  
  Parameters
  ----------
  patience : int, default is -1
      How many epochs with no improvement after which train will be early stopped.
      Negative patience means infinite petience.
  metric_fn : function, default is None
      The function to apply to metric value if any. For example, you can use
      the `metric_fn` to cast loss to negative values where lower loss is better.
      `min_delta`, `baseline_value` and `max_value` are all based on output of `metric_fn`.
  min_delta : float, default is 1e-4
      Early stopper ignores changes less than `min_delta` for metrics to ignore tiny fluctuates.
  baseline_value : float, default is 0.0
      The baseline metric value to be considered.
  max_value : float, default is 1.0
      Instantly early stop if reaching max value.
docstr: Update with end of epoch metric.
  
  Parameters
  ----------
  metric_value : float
      The end of epoch metric.
  epoch : int, optional
      The real epoch in case the update function is not called in every epoch.
docstr_tok: ["Update","with","end","of","epoch","metric",".","Parameters","--","--","--","--","--","metric_value",":","float","The","end","of","epoch","metric",".","epoch",":","int",",","optional","The","real","epoch","in","case","the","update","function","is","not","called","in","every","epoch","."]
code: def update(self, metric_value, epoch=None):
      """Update with end of epoch metric.
  
      Parameters
      ----------
      metric_value : float
          The end of epoch metric.
      epoch : int, optional
          The real epoch in case the update function is not called in every epoch.
  
      """
      if _is_real_number(epoch):
          if _is_real_number(self.last_epoch):
              diff_epoch = epoch - self.last_epoch
          else:
              diff_epoch = 1
          self.last_epoch = epoch
      else:
          diff_epoch = 1
      if not _is_real_number(metric_value):
          return
      if self.metric_fn is not None:
          metric_value = self.metric_fn(metric_value)
  
      if metric_value > self.max_value:
          self._should_stop = True
          self._message = "EarlyStop given {} vs. max {}".format(
              metric_value, self.max_value
          )
      else:
          if metric_value - self.min_delta > self.best:
              self.best = metric_value
              self.wait = 0
          else:
              self.wait += diff_epoch
              if self.wait >= self.patience:
                  self._should_stop = True
                  self._message = "EarlyStop after {} epochs: no better than {}".format(
                      self.patience, self.best
                  )
  
file_path: gluon-cv/gluoncv/auto/estimators/utils.py
imports: import numpy
label_desc: Use image node_id 3 for calling the EarlyStopperOnPlateau obj's underlying member method code with example usage: obj.update(metric_value, epoch) without return types