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 hydrate a metric tracker from a serialized state.
docstr_tok: ["A","`","Trainer","`","can","use","this","to","hydrate","a","metric","tracker","from","a","serialized","state","."]
code: def load_state_dict(self, state_dict: Dict[str, Any]) -> None:
      """
      A `Trainer` can use this to hydrate a metric tracker from a serialized state.
      """
      self._best_so_far = state_dict["best_so_far"]
      self._epochs_with_no_improvement = state_dict[
          "epochs_with_no_improvement"
      ]
      self._is_best_so_far = state_dict["is_best_so_far"]
      self._epoch_number = state_dict["epoch_number"]
      self.best_epoch = state_dict["best_epoch"]
  
      # Even though we don't promise backwards compatibility for the --recover flag,
      # it's particularly easy and harmless to provide it here, so we do it.
      self.best_epoch_metrics = state_dict.get("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 4 for calling the MetricTracker obj's underlying member method code with example usage: obj.load_state_dict(state_dict) without return types