Basic fix for Jaccard on all zero data (issue
@@ -163,6 +163,9 @@ def jaccard(x, y):
num_non_zero += (x_true or y_true)
num_equal += (x_true and y_true)
+ if num_non_zero == 0.0:
+ return 1.0
+ else:
return float(num_non_zero - num_equal) / num_non_zero
