From ba5f70fcb9338d173680b386620b676d65a38ef9 Mon Sep 17 00:00:00 2001 From: Amrit K Date: Mon, 4 Mar 2024 10:59:12 -0500 Subject: [PATCH] Fix docstring examples, typo --- .../evaluate/metrics/experimental/functional/roc.py | 2 +- .../metrics/experimental/precision_recall_curve.py | 12 ++++++------ cyclops/evaluate/metrics/experimental/roc.py | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cyclops/evaluate/metrics/experimental/functional/roc.py b/cyclops/evaluate/metrics/experimental/functional/roc.py index 0034faaa8..a9b7c9aac 100644 --- a/cyclops/evaluate/metrics/experimental/functional/roc.py +++ b/cyclops/evaluate/metrics/experimental/functional/roc.py @@ -130,7 +130,7 @@ def binary_roc( ------- ROCCurve A named tuple containing the false positive rate (FPR), true positive rate - (TPR) and thresholds. The FPR and TPR are arrays of of shape + (TPR) and thresholds. The FPR and TPR are arrays of shape `(num_thresholds + 1,)` and the thresholds are an array of shape `(num_thresholds,)`. diff --git a/cyclops/evaluate/metrics/experimental/precision_recall_curve.py b/cyclops/evaluate/metrics/experimental/precision_recall_curve.py index b6a89ca50..6c486310d 100644 --- a/cyclops/evaluate/metrics/experimental/precision_recall_curve.py +++ b/cyclops/evaluate/metrics/experimental/precision_recall_curve.py @@ -55,14 +55,14 @@ class BinaryPrecisionRecallCurve(Metric, registry_key="binary_precision_recall_c >>> preds = anp.asarray([0.11, 0.22, 0.84, 0.73, 0.33, 0.92]) >>> metric = BinaryPrecisionRecallCurve(thresholds=None) >>> metric(target, preds) - (Array([0.5 , 0.6 , 0.5 , 0.6666667, - 0.5 , 1. , 1. ], dtype=float32), Array([1. , 1. , 0.6666667 , 0.6666667 , - 0.33333334, 0.33333334, 0. ], dtype=float32), Array([0.11, 0.22, 0.33, 0.73, 0.84, 0.92], dtype=float64)) + PRCurve(precision=Array([0.5 , 0.6 , 0.5 , 0.6666667, + 0.5 , 1. , 1. ], dtype=float32), recall=Array([1. , 1. , 0.6666667 , 0.6666667 , + 0.33333334, 0.33333334, 0. ], dtype=float32), thresholds=Array([0.11, 0.22, 0.33, 0.73, 0.84, 0.92], dtype=float64)) >>> metric = BinaryPrecisionRecallCurve(thresholds=5) >>> metric(target, preds) - (Array([0.5 , 0.5 , 0.6666667, 0.5 , - 0. , 1. ], dtype=float32), Array([1. , 0.6666667 , 0.6666667 , 0.33333334, - 0. , 0. ], dtype=float32), Array([0. , 0.25, 0.5 , 0.75, 1. ], dtype=float32)) + PRCurve(precision=Array([0.5 , 0.5 , 0.6666667, 0.5 , + 0. , 1. ], dtype=float32), recall=Array([1. , 0.6666667 , 0.6666667 , 0.33333334, + 0. , 0. ], dtype=float32), thresholds=Array([0. , 0.25, 0.5 , 0.75, 1. ], dtype=float32)) """ # noqa: W505 diff --git a/cyclops/evaluate/metrics/experimental/roc.py b/cyclops/evaluate/metrics/experimental/roc.py index 9a0c3f3a0..766f1c9f5 100644 --- a/cyclops/evaluate/metrics/experimental/roc.py +++ b/cyclops/evaluate/metrics/experimental/roc.py @@ -43,14 +43,14 @@ class BinaryROC(BinaryPrecisionRecallCurve, registry_key="binary_roc_curve"): >>> preds = anp.asarray([0.11, 0.22, 0.84, 0.73, 0.33, 0.92]) >>> metric = BinaryROC(thresholds=None) >>> metric(target, preds) - (Array([0. , 0. , 0.33333334, 0.33333334, - 0.6666667 , 0.6666667 , 1. ], dtype=float32), Array([0. , 0.33333334, 0.33333334, 0.6666667 , - 0.6666667 , 1. , 1. ], dtype=float32), Array([1. , 0.92, 0.84, 0.73, 0.33, 0.22, 0.11], dtype=float64)) + ROCCurve(fpr=Array([0. , 0. , 0.33333334, 0.33333334, + 0.6666667 , 0.6666667 , 1. ], dtype=float32), tpr=Array([0. , 0.33333334, 0.33333334, 0.6666667 , + 0.6666667 , 1. , 1. ], dtype=float32), thresholds=Array([1. , 0.92, 0.84, 0.73, 0.33, 0.22, 0.11], dtype=float64)) >>> metric = BinaryROC(thresholds=5) >>> metric(target, preds) - (Array([0. , 0.33333334, 0.33333334, 0.6666667 , - 1. ], dtype=float32), Array([0. , 0.33333334, 0.6666667 , 0.6666667 , - 1. ], dtype=float32), Array([1. , 0.75, 0.5 , 0.25, 0. ], dtype=float32)) + ROCCurve(fpr=Array([0. , 0.33333334, 0.33333334, 0.6666667 , + 1. ], dtype=float32), tpr=Array([0. , 0.33333334, 0.6666667 , 0.6666667 , + 1. ], dtype=float32), thresholds=Array([1. , 0.75, 0.5 , 0.25, 0. ], dtype=float32)) """ # noqa: W505