code: def _interpolate_pr(
      precision, recall, thresholds=None, num_points=101
  ):
      has_thresholds = thresholds is not None
  
      pre = np.zeros(num_points)
      thr = np.zeros(num_points) if has_thresholds else None
      rec = np.linspace(0, 1, num_points)
  
      if precision is None or recall is None:
          return pre, rec, thr
  
      # Ensure precision is nondecreasing
      precision = precision.copy()
      for i in range(len(precision) - 1, 0, -1):
          if precision[i] > precision[i - 1]:
              precision[i - 1] = precision[i]
  
      inds = np.searchsorted(recall, rec, side="left")
  
      try:
          for ri, pi in enumerate(inds):
              pre[ri] = precision[pi]
              if has_thresholds:
                  thr[ri] = thresholds[pi]
      except:
          pass
  
      return pre, rec, thr
  
imports: from collections import defaultdict
  from copy import deepcopy
  import numpy
  import fiftyone.core.plots
  import fiftyone.utils.iou
  from .detection import DetectionEvaluation, DetectionEvaluationConfig, DetectionResults
label_desc: Use image node_id 8 for calling a global function with example usage: _interpolate_pr(precision, recall, thresholds, num_points) and returns: pre,  rec,  thr, pre,  rec,  thr