Skip to content

Commit

Permalink
fix(Evaluation): catch no-possible AUROC computation
Browse files Browse the repository at this point in the history
  • Loading branch information
muellerdo committed Jun 28, 2022
1 parent 2f90edd commit c31355d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aucmedi/evaluation/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ def compute_metrics(preds, labels, n_labels, threshold=None):
data_dict["F1"] = np.divide(2*tp, 2*tp+fp+fn)

# Compute area under the ROC curve
data_dict["AUC"] = roc_auc_score(truth, pred_prob)
try:
data_dict["AUC"] = roc_auc_score(truth, pred_prob)
except:
print("ROC AUC score is not defined.")

# Parse metrics to dataframe
df = pd.DataFrame.from_dict(data_dict, orient="index",
Expand Down

0 comments on commit c31355d

Please sign in to comment.