Fix sparse jaccard distance as well (issue
@@ -585,6 +585,9 @@ def sparse_jaccard(ind1, data1, ind2, data2):
num_non_zero = arr_union(ind1, ind2).shape[0]
num_equal = arr_intersect(ind1, ind2).shape[0]
+ if num_non_zero == 0:
+ return 0.0
+ else:
return float(num_non_zero - num_equal) / num_non_zero
