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.
docstr: A `Trainer` can use this to serialize the state of the metric tracker.
docstr_tok: ["A","`","Trainer","`","can","use","this","to","serialize","the","state","of","the","metric","tracker","."]
code: def state_dict(self) -> Dict[str, Any]:
      """
      A `Trainer` can use this to serialize the state of the metric tracker.
      """
      return {
          "best_so_far": self._best_so_far,
          "epochs_with_no_improvement": self._epochs_with_no_improvement,
          "is_best_so_far": self._is_best_so_far,
          "epoch_number": self._epoch_number,
          "best_epoch": self.best_epoch,
          "best_epoch_metrics": self.best_epoch_metrics,
      }
  
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 3 for calling the MetricTracker obj's underlying member method code with example usage: obj.state_dict() and returns: dict