code: def micro_avg(class_metrics):
      """
      Takes a dictionary of class metrics and calculates micro F1
  
      :param class_metrics: A dictionary of class metrics as produced by
      calc_class_metrics()
      :return: Micro F1
      """
      TP = sum([c["true_positives"] for c in class_metrics.values()])
      FP = sum([c["false_positives"] for c in class_metrics.values()])
      FN = sum([c["false_negatives"] for c in class_metrics.values()])
      precision = calc_precision(TP, FP)
      recall = calc_recall(TP, FN)
      return calc_f1(recall, precision)
  
imports: from copy import deepcopy
  from collections import namedtuple
  import numpy
  from scipy.optimize import linear_sum_assignment
  from finetune.util.metrics import _convert_to_token_list, _get_unique_classes, calc_precision, calc_recall, calc_f1
label_desc: Use image node_id 13 for calling a global function with example usage: micro_avg(class_metrics) and returns: calc_f1