Distance computations (scipy.spatial.distance)#
Function reference#
Distance matrix computation from a collection of raw observation vectorsstored in a rectangular array.
| Pairwise distances between observations in n-dimensional space. |
| Compute distance between each pair of the two collections of inputs. |
| Convert a vector-form distance vector to a square-form distance matrix, and vice-versa. |
| Compute the directed Hausdorff distance between two 2-D arrays. |
Predicates for checking the validity of distance matrices, bothcondensed and redundant. Also contained in this module are functionsfor computing the number of observations in a distance matrix.
| Return True if input array satisfies basic distance matrix properties (symmetry and zero diagonal). |
| Return True if the input array is a valid condensed distance matrix. |
| Return the number of original observations that correspond to a square, redundant distance matrix. |
| Return the number of original observations that correspond to a condensed distance matrix. |
Distance functions between two numeric vectorsu andv. Computingdistances over a large collection of vectors is inefficient for thesefunctions. Usepdist for this purpose.
| Compute the Bray-Curtis distance between two 1-D arrays. |
| Compute the Canberra distance between two 1-D arrays. |
| Compute the Chebyshev distance. |
| Compute the City Block (Manhattan) distance. |
| Compute the correlation distance between two 1-D arrays. |
| Compute the Cosine distance between 1-D arrays. |
| Computes the Euclidean distance between two 1-D arrays. |
| Compute the Jensen-Shannon distance (metric) between two probability arrays. |
| Compute the Mahalanobis distance between two 1-D arrays. |
| Compute the Minkowski distance between two 1-D arrays. |
| Return the standardized Euclidean distance between two 1-D arrays. |
| Compute the squared Euclidean distance between two 1-D arrays. |
Distance functions between two boolean vectors (representing sets)u andv. As in the case of numerical vectors,pdist is more efficient forcomputing the distances between all pairs.
| Compute the Dice dissimilarity between two boolean 1-D arrays. |
| Compute the Hamming distance between two 1-D arrays. |
| Compute the Jaccard dissimilarity between two boolean vectors. |
| Compute the Rogers-Tanimoto dissimilarity between two boolean 1-D arrays. |
| Compute the Russell-Rao dissimilarity between two boolean 1-D arrays. |
| Compute the Sokal-Sneath dissimilarity between two boolean 1-D arrays. |
| Compute the Yule dissimilarity between two boolean 1-D arrays. |
hamming also operates over discrete numerical vectors.