Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

src/n/i/nipy-0.3.0/examples/algorithms/ward_clustering.py   nipy(Download)
 
from nipy.algorithms.graph import knn
from nipy.algorithms.clustering.hierarchical_clustering import ward
 
# n = number of points, k = number of nearest neighbours
X[:np.ceil(n / 3)] += 3
G = knn(X, 5)
tree = ward(G, X, verbose)
 
threshold = .5 * n