class_docstr: An abstract class representing a metric which accumulates TPs, FPs, and FNs.
  
  :param average: This determines the type of averaging performed            on the data: 'micro' (calculate metrics globally by
  counting the total true positives, false negatives and false positives)            , 'macro' (calculate metrics for each label,
  and find their unweighted mean).
class_docstr_tok: ["An","abstract","class","representing","a","metric","which","accumulates","TPs",",","FPs",",","and","FNs",".",":","param","average",":","This","determines","the","type","of","averaging","performed","on","the","data",":","'micro","'","(","calculate","metrics","globally","by","counting","the","total","true","positives",",","false","negatives","and","false","positives",")",",","'macro","'","(","calculate","metrics","for","each","label",",","and","find","their","unweighted","mean",")","."]
docstr: Computes the metrics starting from TPs, FPs, and FNs.
  
  :return: A Dict per label containing a tuple for                precision, recall and f1-measure. Additionally, an ``overall``
  key is included, which provides the precision, recall and f1-measure                for all spans (depending on the averaging
  modality.).
docstr_tok: ["Computes","the","metrics","starting","from","TPs",",","FPs",",","and","FNs",".",":","return",":","A","Dict","per","label","containing","a","tuple","for","precision",",","recall","and","f1-measure",".","Additionally",",","an","``","overall","``","key","is","included",",","which","provides","the","precision",",","recall","and","f1-measure","for","all","spans","(","depending","on","the","averaging","modality",".",")","."]
code: def get_metric(self) -> Dict[str, Tuple[float, ...]]:
      """
          Computes the metrics starting from TPs, FPs, and FNs.
  
          :return: A Dict per label containing a tuple for\
                  precision, recall and f1-measure. Additionally, an ``overall``
          key is included, which provides the precision, recall and f1-measure\
                  for all spans (depending on the averaging
          modality.).
  
          """
      all_tags: Set[str] = set()
      all_tags.update(self._true_positives.keys())
      all_tags.update(self._false_positives.keys())
      all_tags.update(self._false_negatives.keys())
  
      all_metrics = {}
  
      # Compute the precision, recall and f1 for all spans jointly.
      for tag in all_tags:
          precision, recall, f1_measure = compute_metrics(
              self._true_positives[tag],
              self._false_positives[tag],
              self._false_negatives[tag],
          )
          all_metrics[tag] = (
              precision,
              recall,
              f1_measure,
              self._true_positives[tag],
              self._false_positives[tag],
              self._false_negatives[tag],
          )
      if self._average == "macro":
          overall_precision = 0.0
          overall_recall = 0.0
          overall_f1_measure = 0.0
          for tag in all_tags:
              precision, recall, f1_measure = compute_metrics(
                  self._true_positives[tag],
                  self._false_positives[tag],
                  self._false_negatives[tag],
              )
              overall_precision += precision
              overall_recall += recall
              overall_f1_measure += f1_measure
          precision = overall_precision / len(all_tags)
          recall = overall_recall / len(all_tags)
          f1_measure = overall_f1_measure / len(all_tags)
      else:
          precision, recall, f1_measure = compute_metrics(
              sum(self._true_positives.values()),
              sum(self._false_positives.values()),
              sum(self._false_negatives.values()),
          )
      all_metrics["overall"] = (
          precision,
          recall,
          f1_measure,
          sum(self._true_positives.values()),
          sum(self._false_positives.values()),
          sum(self._false_negatives.values()),
      )
  
      return all_metrics
  
imports: from collections import defaultdict
  from copy import copy
  from typing import Dict, List, Set, Tuple
  from .distance import Distance
label_desc: Use image node_id 3 for calling the ErrorMetric obj's underlying member method code with example usage: obj.get_metric() and returns: all_metrics