I plugged in the distance measures, for the `compute_ncd` function. (Jaccard/Dice have been negated and the -1 removed.)
def euclidean(x1, x2):
return np.sum(np.square(x1 - x2))
def jaccard(x1, x2):
x1_binary = x1 > 0.5
x2_binary = x2 > 0.5
return np.logical_or(x1_binary, x2_binary).sum() / np.logical_and(x1_binary, x2_binary).sum()
def dice(x1, x2):
x1_binary = x1 > 0.5
x2_binary = x2 > 0.5
return 2 * np.logical_or(x1_binary, x2_binary).sum() / (x1_binary.sum() + x2_binary.sum())
[1] https://github.com/Jakob-98/mono/blob/73168bc0ea904e75865815...