ScipyKdTreeDist#

class datafold.pcfold.distance.ScipyKdTreeDist(cut_off, metric='euclidean', kmin=None, **backend_options)[source]#

Bases: DistanceAlgorithm

Sparse distance matrix computation using scipy’s kd-tree implementation.

Parameters:
  • cut_off (float) – Distance values (always Euclidean metric) that are larger are not stored in distance matrix.

  • metric (str) – “euclidean” or “sqeuclidean”

  • kmin (int) – store at least kmin samples per sample

  • backend_options – key word arguments passed to cKDTree

References

scipy.spatial.cKDTree scipy.spatial.KDTree.sparse_distance_matrix()

Attributes Summary

name

Methods Summary

__call__(X[, Y])

Compute distance matrix.

is_symmetric()

Attributes Documentation

name: str = 'scipy.kdtree'#

Methods Documentation

__call__(X, Y=None)[source]#

Compute distance matrix.

Parameters:
  • X (ndarray) – Reference dataset of shape (n_samples_X, n_features).

  • Y (Optional[ndarray]) – Query dataset of shape (n_samples_Y, n_features). If set then the computation is component-wise and if None, the reference dataset is taken as the query points (i.e. Y=X).

Returns:

distance matrix

Return type:

scipy.sparse.csr_matrix

classmethod is_symmetric()[source]#