class_docstr: Analyze results of machine learning experiments.
docstr: Calculate the average time for fitting the strategy.
  
  Parameters
  ----------
  unit : string (must be either 's' for seconds, 'm' for minutes or 'h' for hours)
      the unit in which the run time will be calculated
  
  Returns
  -------
  run_times: Pandas DataFrame
      average run times per estimator and strategy
docstr_tok: ["Calculate","the","average","time","for","fitting","the","strategy",".","Parameters","--","--","--","--","--","unit",":","string","(","must","be","either","'s","'","for","seconds",",","'m","'","for","minutes","or","'","h","'","for","hours",")","the","unit","in","which","the","run","time","will","be","calculated","Returns","--","--","--","-","run_times",":","Pandas","DataFrame","average","run","times","per","estimator","and","strategy"]
code: def fit_runtime(self, unit="s", train_or_test="test", cv_fold="all"):
      """Calculate the average time for fitting the strategy.
  
      Parameters
      ----------
      unit : string (must be either 's' for seconds, 'm' for minutes or 'h' for hours)
          the unit in which the run time will be calculated
  
      Returns
      -------
      run_times: Pandas DataFrame
          average run times per estimator and strategy
      """
      # check input
      if isinstance(cv_fold, int) and cv_fold >= 0:
          cv_folds = [cv_fold]  # if single fold, make iterable
      elif cv_fold == "all":
          cv_folds = np.arange(self.results.cv.get_n_splits())
          if len(cv_folds) == 0:
              raise ValueError()
      else:
          raise ValueError(
              f"`cv_fold` must be either positive integer (>=0) or 'all', "
              f"but found: {type(cv_fold)}"
          )
  
      # load all predictions
      run_times = pd.DataFrame(
          columns=[
              "strategy_name",
              "dataset_name",
              "fit_estimator_start_time",
              "fit_estimator_end_time",
              "cv_fold",
          ]
      )
      for cv_fold in cv_folds:
          for result in self.results.load_predictions(
              cv_fold=cv_fold, train_or_test=train_or_test
          ):
              # unwrap result object
              strategy_name = result.strategy_name
              dataset_name = result.dataset_name
              fit_estimator_start_time = result.fit_estimator_start_time
              fit_estimator_end_time = result.fit_estimator_end_time
              predict_estimator_start_time = (
                  result.predict_estimator_start_time
              )
              predict_estimator_end_time = (
                  result.predict_estimator_end_time
              )
              unwrapped = pd.DataFrame(
                  {
                      "strategy_name": [strategy_name],
                      "dataset_name": [dataset_name],
                      "fit_estimator_start_time": [
                          fit_estimator_start_time
                      ],
                      "fit_estimator_end_time": [
                          fit_estimator_end_time
                      ],
                      "predict_estimator_start_time": [
                          predict_estimator_start_time
                      ],
                      "predict_estimator_end_time": [
                          predict_estimator_end_time
                      ],
                      "cv_fold": [cv_fold],
                  }
              )
              run_times = pd.concat(
                  [run_times, unwrapped], ignore_index=True
              )
  
      # calculate run time difference
      run_times["fit_runtime"] = (
          run_times["fit_estimator_end_time"]
          - run_times["fit_estimator_start_time"]
      ) / np.timedelta64(1, unit)
      run_times["predict_runtime"] = (
          run_times["predict_estimator_end_time"]
          - run_times["predict_estimator_start_time"]
      ) / np.timedelta64(1, unit)
  
      return pd.pivot_table(
          run_times,
          index=["strategy_name", "dataset_name"],
          values=["fit_runtime", "predict_runtime"],
          aggfunc={
              "fit_runtime": np.average,
              "predict_runtime": np.average,
          },
      )
  
imports: import itertools
  import numpy
  import pandas
  from scipy import stats
  from scipy.stats import ranksums, ttest_ind
  from sktime.benchmarking.base import BaseResults
  from sktime.exceptions import NotEvaluatedError
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 16 for calling the Evaluator obj's underlying member method code with example usage: obj.fit_runtime(unit, train_or_test, cv_fold) and returns: pd