code: def confusion_to_macro_f1(confusion_matrix):
      """
      Return the macro f1 for a confusion matrix.
      """
      sum_f1 = 0.0
      results = confusion_to_f1(confusion_matrix)
      for k in results.keys():
          sum_f1 = sum_f1 + results[k].f1
  
      return sum_f1 / len(results)
  
imports: from collections import defaultdict, namedtuple
label_desc: Use image node_id 5 for calling a global function with example usage: confusion_to_macro_f1(confusion_matrix) and returns: unknown