code: def get_model_accuracy_dict(nixtla_results_df, metric=r2_score):
      """Calculates accuracy for each model in the nixtla results df."""
      accuracy_dict = {}
      for column in nixtla_results_df.columns:
          if column in ["unique_id", "ds", "y", "cutoff"]:
              continue
          model_error = metric(
              nixtla_results_df["y"], nixtla_results_df[column]
          )
          accuracy_dict[column] = model_error
      return accuracy_dict
  
file_path: mindsdb/mindsdb/integrations/utilities/time_series_utils.py
imports: import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from sklearn.metrics import r2_score
  from mindsdb.utilities import log
label_desc: Use image node_id 4 for calling a global function with example usage: get_model_accuracy_dict(nixtla_results_df, metric) and returns: accuracy_dict