mfajcik commited on
Commit
bfab51a
Β·
verified Β·
1 Parent(s): 439a704

Upload mc_auroc.py

Browse files

NaN cases are now set to 0.

Files changed (1) hide show
  1. mc_auroc.py +4 -0
mc_auroc.py CHANGED
@@ -117,6 +117,10 @@ class AVG_MULTICLASS_AUROC(evaluate.Metric):
117
 
118
  roc_auc[i] = auc(fpr[i], tpr[i])
119
 
 
 
 
 
120
  # Compute average AUC
121
  average_auc = numpy.mean(list(roc_auc.values()))
122
  average_auc_ci_low = numpy.mean(list(roc_auc_ci_low.values()))
 
117
 
118
  roc_auc[i] = auc(fpr[i], tpr[i])
119
 
120
+ # if AUC is NaN, set it to 0
121
+ if numpy.isnan(roc_auc[i]):
122
+ roc_auc[i] = 0
123
+
124
  # Compute average AUC
125
  average_auc = numpy.mean(list(roc_auc.values()))
126
  average_auc_ci_low = numpy.mean(list(roc_auc_ci_low.values()))