Skip to content

Commit

Permalink
Change ValueError to TypeError and update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
fcogidi committed Jan 9, 2024
1 parent c1ed1fb commit b6f7713
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions cyclops/evaluate/metrics/experimental/functional/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions cyclops/evaluate/metrics/experimental/functional/f_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cyclops/evaluate/metrics/experimental/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check warning on line 65 in cyclops/evaluate/metrics/experimental/utils/validation.py

View check run for this annotation

Codecov / codecov/patch

cyclops/evaluate/metrics/experimental/utils/validation.py#L65

Added line #L65 was not covered by tests
"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(

Check warning on line 71 in cyclops/evaluate/metrics/experimental/utils/validation.py

View check run for this annotation

Codecov / codecov/patch

cyclops/evaluate/metrics/experimental/utils/validation.py#L71

Added line #L71 was not covered by tests
"Expected `preds` to be an array-API-compatible object, but got "
f"{type(preds)}.",
)
Expand Down

0 comments on commit b6f7713

Please sign in to comment.