From b6f771302864f63bc1493b06395cbd0757682f1d Mon Sep 17 00:00:00 2001 From: Franklin <41602287+fcogidi@users.noreply.github.com> Date: Tue, 9 Jan 2024 17:56:52 -0500 Subject: [PATCH] Change ValueError to TypeError and update docstrings --- .../metrics/experimental/functional/accuracy.py | 6 +++--- .../metrics/experimental/functional/f_score.py | 12 ++++++------ .../functional/negative_predictive_value.py | 6 +++--- .../experimental/functional/precision_recall.py | 12 ++++++------ .../metrics/experimental/functional/specificity.py | 6 +++--- .../metrics/experimental/utils/validation.py | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cyclops/evaluate/metrics/experimental/functional/accuracy.py b/cyclops/evaluate/metrics/experimental/functional/accuracy.py index f4617e919..f7d009115 100644 --- a/cyclops/evaluate/metrics/experimental/functional/accuracy.py +++ b/cyclops/evaluate/metrics/experimental/functional/accuracy.py @@ -68,7 +68,7 @@ def binary_accuracy( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -216,7 +216,7 @@ def multiclass_accuracy( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -378,7 +378,7 @@ def multilabel_accuracy( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError diff --git a/cyclops/evaluate/metrics/experimental/functional/f_score.py b/cyclops/evaluate/metrics/experimental/functional/f_score.py index 401d25f5b..6cb74db4d 100644 --- a/cyclops/evaluate/metrics/experimental/functional/f_score.py +++ b/cyclops/evaluate/metrics/experimental/functional/f_score.py @@ -144,7 +144,7 @@ def binary_fbeta_score( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -276,7 +276,7 @@ def multiclass_fbeta_score( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -468,7 +468,7 @@ def multilabel_fbeta_score( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -593,7 +593,7 @@ def binary_f1_score( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -692,7 +692,7 @@ def multiclass_f1_score( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -824,7 +824,7 @@ def multilabel_f1_score( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError diff --git a/cyclops/evaluate/metrics/experimental/functional/negative_predictive_value.py b/cyclops/evaluate/metrics/experimental/functional/negative_predictive_value.py index 81a1fd5ed..2ca4411cc 100644 --- a/cyclops/evaluate/metrics/experimental/functional/negative_predictive_value.py +++ b/cyclops/evaluate/metrics/experimental/functional/negative_predictive_value.py @@ -87,7 +87,7 @@ def binary_npv( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -200,7 +200,7 @@ def multiclass_npv( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -360,7 +360,7 @@ def multilabel_npv( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError diff --git a/cyclops/evaluate/metrics/experimental/functional/precision_recall.py b/cyclops/evaluate/metrics/experimental/functional/precision_recall.py index b4411db31..283b485cc 100644 --- a/cyclops/evaluate/metrics/experimental/functional/precision_recall.py +++ b/cyclops/evaluate/metrics/experimental/functional/precision_recall.py @@ -95,7 +95,7 @@ def binary_precision( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -206,7 +206,7 @@ def multiclass_precision( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -364,7 +364,7 @@ def multilabel_precision( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -478,7 +478,7 @@ def binary_recall( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -589,7 +589,7 @@ def multiclass_recall( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -750,7 +750,7 @@ def multilabel_recall( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError diff --git a/cyclops/evaluate/metrics/experimental/functional/specificity.py b/cyclops/evaluate/metrics/experimental/functional/specificity.py index 328deebc0..da27e0957 100644 --- a/cyclops/evaluate/metrics/experimental/functional/specificity.py +++ b/cyclops/evaluate/metrics/experimental/functional/specificity.py @@ -87,7 +87,7 @@ def binary_specificity( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -199,7 +199,7 @@ def multiclass_specificity( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError @@ -359,7 +359,7 @@ def multilabel_specificity( Raises ------ - ValueError + TypeError If the arrays `target` and `preds` are not compatible with the Python array API standard. ValueError diff --git a/cyclops/evaluate/metrics/experimental/utils/validation.py b/cyclops/evaluate/metrics/experimental/utils/validation.py index db6122feb..5f02c090a 100644 --- a/cyclops/evaluate/metrics/experimental/utils/validation.py +++ b/cyclops/evaluate/metrics/experimental/utils/validation.py @@ -62,13 +62,13 @@ def _basic_input_array_checks( ) -> None: """Perform basic validation of `target` and `preds`.""" if not apc.is_array_api_obj(target): - raise ValueError( + raise TypeError( "Expected `target` to be an array-API-compatible object, but got " f"{type(target)}.", ) if not apc.is_array_api_obj(preds): - raise ValueError( + raise TypeError( "Expected `preds` to be an array-API-compatible object, but got " f"{type(preds)}.", )