code: def compute_metrics(
      true_positives: float,
      false_positives: float,
      false_negatives: float,
  ) -> Tuple[float, float, float]:
      """
      This static method computes precision, recall and f-measure out of\
              TPs, FPs, and FNs.
  
      :param true_positives: The number of true positives.
      :param false_positives: The number of false positives.
      :param false_negatives: The number of false negatives.
      :return: A tuple with precision, recall and f-measure.
      """
      if true_positives == 0.0 and false_positives == 0.0:
          precision = 0.0
      else:
          precision = float(true_positives) / float(
              true_positives + false_positives
          )
      if true_positives == 0.0 and false_negatives == 0.0:
          recall = 0.0
      else:
          recall = float(true_positives) / float(
              true_positives + false_negatives
          )
      if precision == 0.0 and recall == 0.0:
          f1_measure = 0.0
      else:
          f1_measure = 2.0 * (
              (precision * recall) / (precision + recall)
          )
      return precision, recall, f1_measure
  
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 1 for calling a global function with example usage: compute_metrics(true_positives, false_positives, false_negatives) and returns: precision,  recall,  f1_measure