15.12.2012 Views

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SciPy Reference Guide, Release 0.8.dev<br />

Note that you should avoid passing a reference to one of the distance functions defined in this<br />

library. For example,:<br />

dm = cdist(XA, XB, sokalsneath)<br />

would calculate the pair-wise distances between the vectors in X using the Python function<br />

sokalsneath. This would result in sokalsneath being called � � n<br />

2 times, which is inefficient. Instead,<br />

the optimized C version is more efficient, and we call it using the following syntax.:<br />

dm = cdist(XA, XB, ’sokalsneath’)<br />

Parameters<br />

XA<br />

[ndarray] An mA by n array of mA original observations in an n-dimensional space.<br />

XB<br />

[ndarray] An mB by n array of mB original observations in an n-dimensional space.<br />

metric<br />

[string or function] The distance metric to use. The distance function can be ‘braycurtis’,<br />

‘canberra’, ‘chebyshev’, ‘cityblock’, ‘correlation’, ‘cosine’, ‘dice’, ‘euclidean’, ‘hamming’,<br />

‘jaccard’, ‘kulsinski’, ‘mahalanobis’, ‘matching’, ‘minkowski’, ‘rogerstanimoto’,<br />

‘russellrao’, ‘seuclidean’, ‘sokalmichener’, ‘sokalsneath’, ‘sqeuclidean’, ‘wminkowski’,<br />

‘yule’.<br />

w<br />

p<br />

V<br />

VI<br />

Returns<br />

Y<br />

[ndarray] The weight vector (for weighted Minkowski).<br />

[double] The p-norm to apply (for Minkowski, weighted and unweighted)<br />

[ndarray] The variance vector (for standardized Euclidean).<br />

[ndarray] The inverse of the covariance matrix (for Mahalanobis).<br />

[ndarray] A mA by mB distance matrix.<br />

chebyshev(u, v)<br />

Computes the Chebyshev distance between two n-vectors u and v, which is defined as<br />

Parameters<br />

u<br />

v<br />

[ndarray] An n-dimensional vector.<br />

[ndarray] An n-dimensional vector.<br />

max |ui − vi|.<br />

i<br />

404 Chapter 3. Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!