code: def micro_f1(true, predicted, span_type="token"):
      count_fn = get_seq_count_fn(span_type)
      class_counts = count_fn(true, predicted)
      TP, FP, FN = 0, 0, 0
      for cls_, counts in class_counts.items():
          FN += len(counts["false_negatives"])
          TP += len(counts["true_positives"])
          FP += len(counts["false_positives"])
      recall = calc_recall(TP, FN)
      precision = calc_precision(TP, FP)
      return calc_f1(recall, precision)
  
imports: import os
  import copy
  from functools import partial
  from collections import defaultdict, OrderedDict
  import numpy
  from sklearn.metrics import confusion_matrix
  from tensorflow.python.platform import gfile
  from tensorflow.python.summary import summary_iterator
  import tabulate
  from finetune.encoding.input_encoder import get_spacy
label_desc: Use image node_id 10 for calling a global function with example usage: micro_f1(true, predicted, span_type) and returns: calc_f1