### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Clustering package (`scipy.cluster`) »
- Hierarchical clustering (`scipy.cluster.hierarchy`) »

# scipy.cluster.hierarchy.cophenet

`scipy.cluster.hierarchy.``cophenet`(Z, Y=None)

  Calculates the cophenetic distances between each observation in the hierarchical clustering defined by the linkage `Z`.

  Suppose `p` and `q` are original observations in disjoint clusters `s` and `t`, respectively and `s` and `t` are joined by a direct parent cluster `u`. The cophenetic distance between observations `i` and `j` is simply the distance between clusters `s` and `t`.

  Parameters : | Z : ndarray The hierarchical clustering encoded as an array (see `linkage` function). Y : ndarray (optional) Calculates the cophenetic correlation coefficient `c` of a hierarchical clustering defined by the linkage matrix `Z` of a set of observations in dimensions. `Y` is the condensed distance matrix from which `Z` was generated.
  Returns : | (c, {d}) - c : ndarray The cophentic correlation distance (if `y` is passed). d : ndarray The cophenetic distance matrix in condensed form. The th entry is the cophenetic distance between original observations and .

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Clustering package (`scipy.cluster`) »
- Hierarchical clustering (`scipy.cluster.hierarchy`) »