scipy 1.8.0 Pypi GitHub Homepage
Other Docs
BackRef

To remove in the future –– scipy.spatial.distance

Distance computations (:mod:`scipy.spatial.distance`)

.. sectionauthor:: Damian Eads
    

Function reference

Distance matrix computation from a collection of raw observation vectors stored in a rectangular array.

.. autosummary:: 
    :toctree:generated/
    pdist   -- pairwise distances between observation vectors.
    cdist   -- distances between two collections of observation vectors
    squareform -- convert distance matrix to a condensed one and vice versa
    directed_hausdorff -- directed Hausdorff distance between arrays

Predicates for checking the validity of distance matrices, both condensed and redundant. Also contained in this module are functions for computing the number of observations in a distance matrix.

.. autosummary:: 
    :toctree:generated/
    is_valid_dm -- checks for a valid distance matrix
    is_valid_y  -- checks for a valid condensed distance matrix
    num_obs_dm  -- # of observations in a distance matrix
    num_obs_y   -- # of observations in a condensed distance matrix

Distance functions between two numeric vectors u and v . Computing distances over a large collection of vectors is inefficient for these functions. Use pdist for this purpose.

.. autosummary:: 
    :toctree:generated/
    braycurtis       -- the Bray-Curtis distance.
    canberra         -- the Canberra distance.
    chebyshev        -- the Chebyshev distance.
    cityblock        -- the Manhattan distance.
    correlation      -- the Correlation distance.
    cosine           -- the Cosine distance.
    euclidean        -- the Euclidean distance.
    jensenshannon    -- the Jensen-Shannon distance.
    mahalanobis      -- the Mahalanobis distance.
    minkowski        -- the Minkowski distance.
    seuclidean       -- the normalized Euclidean distance.
    sqeuclidean      -- the squared Euclidean distance.

Distance functions between two boolean vectors (representing sets) u and v . As in the case of numerical vectors, pdist is more efficient for computing the distances between all pairs.

.. autosummary:: 
    :toctree:generated/
    dice             -- the Dice dissimilarity.
    hamming          -- the Hamming distance.
    jaccard          -- the Jaccard distance.
    kulsinski        -- the Kulsinski distance.
    kulczynski1      -- the Kulczynski 1 distance.
    rogerstanimoto   -- the Rogers-Tanimoto dissimilarity.
    russellrao       -- the Russell-Rao dissimilarity.
    sokalmichener    -- the Sokal-Michener dissimilarity.
    sokalsneath      -- the Sokal-Sneath dissimilarity.
    yule             -- the Yule dissimilarity.

hamming also operates over discrete numerical vectors.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.spatial.distance.canberra scipy.spatial.distance.dice scipy.spatial.distance.braycurtis scipy.spatial.distance.euclidean scipy.spatial.distance.yule scipy.spatial.distance.sokalmichener scipy.spatial.distance.hamming scipy.spatial.distance.jensenshannon scipy.spatial.distance.sqeuclidean scipy.spatial.distance.minkowski scipy.spatial.distance.kulczynski1 scipy.spatial.distance.kulsinski scipy.signal._peak_finding.find_peaks scipy.spatial.distance.jaccard scipy.spatial.distance.chebyshev scipy.spatial.distance.cdist scipy.spatial.distance.mahalanobis scipy.spatial.distance.rogerstanimoto scipy.spatial.distance.russellrao scipy.spatial.distance.cosine scipy.spatial.distance.directed_hausdorff scipy.spatial.distance.seuclidean scipy.spatial.distance.sokalsneath scipy.spatial.distance.cityblock

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/spatial/distance.py#0
type: <class 'module'>
Commit: