class_docstr: Track the result of an epoch.
  
  Args:
      metrics_for_best_model: A set of entry to calculate validation score.
      mode: (default = None) "train" or "valid" mode.
      axes: (default = None) The timestamp for the moment.
class_docstr_tok: ["Track","the","result","of","an","epoch",".","Args",":","metrics_for_best_model",":","A","set","of","entry","to","calculate","validation","score",".","mode",":","(","default","=","None",")","``","train","''","or","``","valid","''","mode",".","axes",":","(","default","=","None",")","The","timestamp","for","the","moment","."]
docstr: calculate the total score of valid metrics for early stopping.
  
  If `loss` is in `keys`, the negative of average loss will be returned.
  Else, the sum of metrics results indexed by keys will be returned.
code: def calc_score(self) -> float:
      """calculate the total score of valid metrics for early stopping.
  
      If `loss` is in `keys`, the negative of average loss will be returned.
      Else, the sum of metrics results indexed by keys will be returned.
      """
  
      if "loss" in self.metrics_for_best_model:
          return -self._avg_loss
      if "score" in self._metrics_results:
          return self._metrics_results["score"]
  
      score = 0.0
      for metric, result in self._metrics_results.items():
          if metric in self.metrics_for_best_model and isinstance(
              result, float
          ):
              score += result
  
      return score
  
imports: from contextlib import contextmanager
  from copy import copy
  from accelerate.logging import get_logger
  import math
  import os
  from time import time
  from typing import Iterable, Optional, Set, Union, Callable
  import traceback
  import torch
  import wandb
  from wandb import AlertLevel
  from textbox.config.configurator import Config
label_desc: Use image node_id 7 for calling the EpochTracker obj's underlying member method code with example usage: obj.calc_score() and returns: score, unknown, self