pycrostates icon indicating copy to clipboard operation
pycrostates copied to clipboard

Distance computation

Open vferat opened this issue 1 year ago • 0 comments

The distance between two vectors should be a linear function

_distance_matrix should be changed from

def _distance_matrix(X, Y=None):
    """Distance matrix used in metrics."""
    distances = np.abs(1 / np.corrcoef(X, Y)) - 1
    distances = np.nan_to_num(
        distances, copy=False, nan=10e300, posinf=1e300, neginf=-1e300
    )
    return distances

to

def _distance_matrix(X, Y=None):
    """Distance matrix used in metrics."""
    distances = 1 - np.abs(1 / np.corrcoef(X, Y))
    return distances

vferat avatar Feb 16 '24 16:02 vferat