class_docstr: This class tracks a metric during training for the dual purposes of early stopping
  and for knowing whether the current value is the best so far. It mimics the PyTorch
  `state_dict` / `load_state_dict` interface, so that it can be checkpointed along with
  your model and optimizer.
  
  Some metrics improve by increasing; others by decreasing. You can provide a
  `metric_name` that starts with "+" to indicate an increasing metric, or "-"
  to indicate a decreasing metric.
  
  # Parameters
  
  metric_name : `Union[str, List[str]]`
      Specifies the metric or metrics to track. Metric names have to start with
      "+" for increasing metrics or "-" for decreasing ones. If you specify more
      than one, it tracks the sum of the increasing metrics metrics minus the sum
      of the decreasing metrics.
  patience : `int`, optional (default = `None`)
      If provided, then `should_stop_early()` returns True if we go this
      many epochs without seeing a new best value.
code: def __init__(
      self,
      metric_name: Union[str, List[str]],
      patience: Optional[int] = None,
  ) -> None:
      self._patience = patience
      self._best_so_far: Optional[float] = None
      self._epochs_with_no_improvement = 0
      self._is_best_so_far = True
      self._epoch_number = 0
      self.best_epoch: Optional[int] = None
      self.best_epoch_metrics: Dict[str, float] = {}
  
      if isinstance(metric_name, str):
          metric_name = [metric_name]
      self.tracked_metrics = []
      for name in metric_name:
          if name.startswith("+"):
              self.tracked_metrics.append((1.0, name[1:]))
          elif name.startswith("-"):
              self.tracked_metrics.append((-1.0, name[1:]))
          else:
              raise ConfigurationError(
                  "metric_name must start with + or -"
              )
  
file_path: allennlp/allennlp/training/metric_tracker.py
imports: from typing import Optional, Dict, Any, List, Union
  from allennlp.common.checks import ConfigurationError
label_desc: Use image node_id 1 to create a new MetricTracker object  with example: obj = MetricTracker(metric_name, patience)