class_docstr: __init__(        self, check_trigger=(1, 'epoch'), monitor='main/loss',         patience=3, mode='auto', verbose=False,         max_trigger=(100, 'epoch'))
  
  Trigger for Early Stopping
  
  It can be used as a stop trigger of :class:`~chainer.training.Trainer`
  to realize *early stopping* technique.
  
  This trigger works as follows.
  Within each *check interval* defined by the ``check_trigger`` argument,
  it monitors and accumulates the reported value at each iteration.
  At the end of each interval, it computes the mean of the accumulated
  values and compares it to the previous ones to maintain the *best* value.
  When it finds that the best value is not updated
  for some periods (defined by ``patience``), this trigger fires.
  
  Args:
      monitor (str) : The metric you want to monitor
      check_trigger: Trigger that decides the comparison
          interval between current best value and new value.
          This must be a tuple in the form of ``<int>,
          'epoch'`` or ``<int>, 'iteration'`` which is passed to
          :class:`~chainer.training.triggers.IntervalTrigger`.
      patience (int) : Counts to let the trigger be patient.
          The trigger will not fire until the condition is met
          for successive ``patience`` checks.
      mode (str) : ``'max'``, ``'min'``, or ``'auto'``.
          It is used to determine how to compare the monitored values.
      verbose (bool) : Enable verbose output.
          If verbose is true, you can get more information
      max_trigger: Upper bound of the number of training loops
  
  .. note::
     ``patients`` is also available as an alias of ``patience`` for
     historical reason.
code: def __init__(
      self,
      check_trigger=(1, "epoch"),
      monitor="main/loss",
      patience=None,
      mode="auto",
      verbose=False,
      max_trigger=(100, "epoch"),
      **kwargs,
  ):
      # `patients` as an alias of `patience`
      (patients,) = argument.parse_kwargs(kwargs, ("patients", None))
      if patients is None:
          if patience is None:
              patience = 3
          else:
              pass
      else:
          if patience is None:
              patience = patients
          else:
              raise TypeError(
                  "Both 'patience' and 'patients' arguments are "
                  "specified. 'patients' is an alias of the former. "
                  "Specify only 'patience'."
              )
  
      self.count = 0
      self.patience = patience
      self.monitor = monitor
      self.verbose = verbose
      self.already_warning = False
      self._max_trigger = util.get_trigger(max_trigger)
      self._interval_trigger = util.get_trigger(check_trigger)
  
      self._init_summary()
  
      if mode == "max":
          self._compare = operator.gt
  
      elif mode == "min":
          self._compare = operator.lt
  
      else:
          if "accuracy" in monitor:
              self._compare = operator.gt
  
          else:
              self._compare = operator.lt
  
      if self._compare == operator.gt:
          if verbose:
              print("early stopping: operator is greater")
          self.best = float("-inf")
  
      else:
          if verbose:
              print("early stopping: operator is less")
          self.best = float("inf")
  
file_path: chainer/chainer/training/triggers/early_stopping_trigger.py
imports: import operator
  import warnings
  from chainer import reporter
  from chainer.training import util
  from chainer.utils import argument
label_desc: Use image node_id 1 to create a new EarlyStoppingTrigger object from inherited base classes: object with example: obj = EarlyStoppingTrigger(check_trigger, monitor, patience, mode, verbose, max_trigger)