code: def test_aggregate_precision_recall_curve(labels_and_scores):
      (
          precisions,
          recalls,
          thresholds,
      ) = aggregate_precision_recall_curve(
          labels_and_scores,
          precision_recall_fn=segment_precision_recall,
      )
      sorted_pr = list(
          zip(
              *sorted(
                  zip(recalls, precisions), key=lambda x: (x[0], x[1])
              )
          )
      )
      pr_auc = auc(*sorted_pr)
      np.testing.assert_almost_equal(pr_auc, 0.49960, 5)
  
file_path: gluonts/test/nursery/anomaly_detection/supervised_metrics/test_precision_recall.py
imports: from typing import Dict, List, Tuple
  import numpy
  import pytest
  from sklearn.metrics import auc
  from gluonts.nursery.anomaly_detection.supervised_metrics import aggregate_precision_recall_curve, buffered_precision_recall, segment_precision_recall
  from gluonts.nursery.anomaly_detection.supervised_metrics._buffered_precision_recall import extend_ranges
  from gluonts.nursery.anomaly_detection.supervised_metrics.bounded_pr_auc import bounded_pr_auc
  from gluonts.nursery.anomaly_detection.supervised_metrics.utils import labels_to_ranges, range_overlap
label_desc: Use image node_id 7 for calling a global function with example usage: test_aggregate_precision_recall_curve(labels_and_scores) without return types