This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / cluster / hierarchy / _hierarchy / nn_chain

cython_function_or_method

scipy.cluster.hierarchy._hierarchy:nn_chain

Signature

def nn_chain(dists, n, method)

Summary

Perform hierarchy clustering using nearest-neighbor chain algorithm.

Parameters

dists : ndarray

A condensed matrix stores the pairwise distances of the observations.

n : int

The number of observations.

method : int

The linkage method. 0: single 1: complete 2: average 3: centroid 4: median 5: ward 6: weighted

Returns

Z : ndarray, shape (n - 1, 4)

Computed linkage matrix.

Aliases

  • scipy.cluster.hierarchy._hierarchy.nn_chain