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.

Parameters<br />

y<br />

Returns<br />

Z<br />

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

[ndarray] The upper triangular of the distance matrix. The result of pdist is returned in<br />

this form.<br />

[ndarray] A linkage matrix containing the hierarchical clustering. See the linkage function<br />

documentation for more information on its structure.<br />

cophenet(Z, Y=None)<br />

Calculates the cophenetic distances between each observation in the hierarchical clustering defined by the<br />

linkage Z.<br />

Suppose p and q are original observations in disjoint clusters s and t, respectively and s and t are joined by<br />

a direct parent cluster u. The cophenetic distance between observations i and j is simply the distance between<br />

clusters s and t.<br />

Parameters<br />

• Z : ndarray The hierarchical clustering encoded as an array (see linkage function).<br />

• Y : ndarray (optional) Calculates the cophenetic correlation coefficient c of a hierarchical<br />

clustering defined by the linkage matrix Z of a set of n observations in m dimensions. Y is<br />

the condensed distance matrix from which Z was generated.<br />

Returns<br />

(c, {d}) - c : ndarray<br />

The cophentic correlation distance (if y is passed).<br />

• d : ndarray The cophenetic distance matrix in condensed form. The ij th entry is the cophenetic<br />

distance between original observations i and j.<br />

correspond(Z, Y)<br />

Checks if a linkage matrix Z and condensed distance matrix Y could possibly correspond to one another.<br />

They must have the same number of original observations for the check to succeed.<br />

This function is useful as a sanity check in algorithms that make extensive use of linkage and distance matrices<br />

that must correspond to the same set of original observations.<br />

Arguments<br />

Returns<br />

• Z<br />

[ndarray] The linkage matrix to check for correspondance.<br />

• Y<br />

[ndarray] The condensed distance matrix to check for correspondance.<br />

• b<br />

[bool] A boolean indicating whether the linkage matrix and distance matrix could possibly<br />

correspond to one another.<br />

3.1. Clustering package (<strong>scipy</strong>.cluster) 133

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

Saved successfully!

Ooh no, something went wrong!