docstr:     Update the internal state of early stopping mechanism, whether to
  continue training or stop the train procedure.
  
      Checks whether the scores from all pre-chosen scorers improved. If
  every metric improve, then the status is switched to improving and the
  tolerance is reset. If every metric deteriorate, then the status is
  switched to decreasing and the tolerance is also decreased; if the
  tolerance reaches 0, then the status is changed to stopped.
  Finally, if some improved and others not, then it's considered stalled;
  after tolerance number of stalled, the status is switched to stopped.
  
  :param valid_stats: Statistics of dev set
docstr_tok: ["Update","the","internal","state","of","early","stopping","mechanism",",","whether","to","continue","training","or","stop","the","train","procedure",".","Checks","whether","the","scores","from","all","pre-chosen","scorers","improved",".","If","every","metric","improve",",","then","the","status","is","switched","to","improving","and","the","tolerance","is","reset",".","If","every","metric","deteriorate",",","then","the","status","is","switched","to","decreasing","and","the","tolerance","is","also","decreased",";","if","the","tolerance","reaches","0",",","then","the","status","is","changed","to","stopped",".","Finally",",","if","some","improved","and","others","not",",","then","it","'s","considered","stalled",";","after","tolerance","number","of","stalled",",","the","status","is","switched","to","stopped",".",":","param","valid_stats",":","Statistics","of","dev","set"]
code: def __call__(self, valid_stats, step):
      """
          Update the internal state of early stopping mechanism, whether to
      continue training or stop the train procedure.
  
          Checks whether the scores from all pre-chosen scorers improved. If
      every metric improve, then the status is switched to improving and the
      tolerance is reset. If every metric deteriorate, then the status is
      switched to decreasing and the tolerance is also decreased; if the
      tolerance reaches 0, then the status is changed to stopped.
      Finally, if some improved and others not, then it's considered stalled;
      after tolerance number of stalled, the status is switched to stopped.
  
      :param valid_stats: Statistics of dev set
      """
  
      if self.status == PatienceEnum.STOPPED:
          # Don't do anything
          return
  
      if all(
          [
              scorer.is_improving(valid_stats)
              for scorer in self.early_stopping_scorers
          ]
      ):
          self._update_increasing(valid_stats, step)
  
      elif all(
          [
              scorer.is_decreasing(valid_stats)
              for scorer in self.early_stopping_scorers
          ]
      ):
          self._update_decreasing()
  
      else:
          self._update_stalled()
  
imports: from enum import Enum
  from onmt.utils.logging import logger
label_desc: Use image node_id 2 for calling the EarlyStopping obj's underlying member method code with example usage: obj.__call__(valid_stats, step) without return types