vferat / pycrostates

https://pycrostates.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
37 stars 11 forks source link

Distance computation #162

Open vferat opened 9 months ago

vferat commented 9 months ago

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