code: def __init__(
      self, metric_name: str, result: Union[int, float, pd.DataFrame]
  ):
      self.metric_name = metric_name
      assert isinstance(
          self.metric_name, str
      ), "metric_name must be a string."
      if isinstance(result, (int, float)):
          self.result = float(result)
          self.result_type = SINGLE_VALUE
      elif isinstance(result, pd.DataFrame):
          if len(result.shape) == 2:
              self.result = result
              self.result_type = TABLE_VALUE
          else:
              raise ValueError("DataFrame must be a 2D table.")
      else:
          raise TypeError(
              "Invalid type for result. Expected int, float or DataFrame."
          )
  
imports: from typing import Dict
  from transformers import EvalPrediction
  from transformers.trainer_utils import PredictionOutput
  import pandas
  import torch
  import numpy
  from typing import Union
  import json
  import logging
label_desc: Use image node_id 1 to create a new EvalResult object from inherited base classes: object with example: obj = EvalResult(metric_name, result)