Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug with specific binary input format #264

Merged
merged 2 commits into from Jan 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions fuse/eval/metrics/libs/classification.py
Expand Up @@ -48,7 +48,7 @@ def auc_roc(
If not ``None``, the standardized partial AUC over the range [0, max_fpr] is returned.
:return auc Receiver operating characteristic score
"""
if not isinstance(pred[0], np.ndarray):
if not isinstance(pred[0], np.ndarray) or len(pred[0].shape) == 0:
pred = [np.array(p) for p in pred]
pos_class_index = 1
y_score = np.asarray(pred)
Expand Down Expand Up @@ -118,7 +118,7 @@ def auc_pr(
:param pos_class_index: the class to compute the metrics in one vs rest manner - set to 1 in binary classification
:return auc precision recall score
"""
if not isinstance(pred[0], np.ndarray):
if not isinstance(pred[0], np.ndarray) or len(pred[0].shape) == 0:
pred = [np.array(p) for p in pred]
pos_class_index = 1
y_score = np.asarray(pred)
Expand Down