def DiceDist(A, B): A, B = set(A), set(B) intersect = len(A.intersection(B)) union = len(A) + len(B) d = try_divide(2 * intersect, union) return d
def DiceDist(A, B): A, B = set(A), set(B) intersect = len(A.intersection(B)) union = len(A) + len(B) d = try_divide(2*intersect, union) return d
def JaccardCoef(A, B): A, B = set(A), set(B) intersect = len(A.intersection(B)) union = len(A.union(B)) coef = try_divide(intersect, union) return coef