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"]
code: def _check_for_improvement(self, measured_values, metric_sign):
      previous_best = self._history[self.metric.name][self._index_best]
      index_last = self._history.shape[0] - 1
  
      delta = measured_values[self.metric.name] - previous_best
      delta_sign = np.sign(delta)
  
      if self.min_delta > 0:
          improvement = (
              delta_sign == metric_sign
              and np.abs(delta) >= self.min_delta
          )
      else:
          improvement = delta_sign == metric_sign
  
      if improvement:
          self._index_best = index_last
          return False
      else:
          history_since_previous_best = self._history[
              self._index_best + 1 :
          ][self.metric.name]
          rows_not_nan = np.logical_not(
              np.isnan(history_since_previous_best)
          )
          if rows_not_nan.sum() > self.patience:
              logging.debug(
                  f"Early stopping: Patience exceeded."
                  f"{{value={index_last-self._index_best}, patience={self.patience}}}"
              )
              return True
          return False
  
imports: import logging
  import numpy
  from abc import ABC
label_desc: Use image node_id 4 for calling the EarlyStopping obj's underlying member method code with example usage: obj._check_for_improvement(measured_values, metric_sign) and returns: False, False, True