code: def singleton_precision_recall(
      true_labels,
      pred_labels,
  ) -> Tuple[float, float]:
      """
  
      Parameters
      ----------
      true_labels
          Binary array of true labels
      pred_labels
          Binary array of predicted labels
  
      Returns
      -------
      precision: float
      recall: float
      """
      precision = 0.0
      recall = 0
  
      tp = np.sum(true_labels * pred_labels)
      true_cond_p = np.sum(true_labels)
      pred_cond_p = np.sum(pred_labels)
  
      if pred_cond_p > 0:
          precision = tp / pred_cond_p
      if true_cond_p > 0:
          recall = tp / true_cond_p
  
      return precision, recall
  
file_path: gluonts/src/gluonts/nursery/anomaly_detection/supervised_metrics/_precision_recall_utils.py
imports: from typing import Callable, Iterable, List, NamedTuple, Optional, Tuple
  import numpy
  from joblib import Parallel, delayed
  from .None import buffered_precision_recall
  from .utils import labels_to_ranges
label_desc: Use image node_id 1 for calling a global function with example usage: singleton_precision_recall(true_labels, pred_labels) and returns: precision,  recall