Skip to content

DisSim implementation correct? #109

@davnn

Description

@davnn

Hi! Thanks for you work with the package. I'm currently trying to understand the implementation of DisSim, which seems to differ from the paper. If idx and dist contain the indices and distances to the n-1 neighbors, equation 8 from the paper would be something like:

def dissim(x, idx, dist):
    centroids = x[idx].mean(axis=1)
    dist_x, dist_y = x - centroids, x[idx] - centroids[idx]
    norm_dist_x = np.einsum("ij,ij -> i", dist_x, dist_x)[:,np.newaxis]
    norm_dist_y = np.einsum("ijk,ijk -> ij", dist_y, dist_y)
    return dist - np.sqrt(norm_dist_x) - np.sqrt(norm_dist_y)

The implemented version returns something like np.sqrt(dist - norm_dist_x - norm_dist_y), where the norms are generated slightly differently. Is this intended and only a documentation problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions