code: def per_class_f1(true, predicted, span_type="token"):
      """
      F1-scores per class
      """
      count_fn = get_seq_count_fn(span_type)
      class_counts = count_fn(true, predicted)
      results = OrderedDict()
      for cls_, counts in class_counts.items():
          results[cls_] = {}
          FP = len(counts["false_positives"])
          FN = len(counts["false_negatives"])
          TP = len(counts["true_positives"])
          recall = calc_recall(TP, FN)
          precision = calc_precision(TP, FP)
          results[cls_]["support"] = FN + TP
          results[cls_]["f1-score"] = calc_f1(recall, precision)
      return results
  
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 11 for calling a global function with example usage: per_class_f1(true, predicted, span_type) and returns: results