scikit-learn/scikit-learn — pull request #3464 by kallada (2014-07-21 20:09:16+00:00)
Title: Added plot_dendrogram function for Hierarchical Clustering

Visualizing the hierarchy of the resulting hierarchical clustering can be useful.

This pull request adds the plot_dendrogram function within sklearn.cluster.hierarchical. This function makes good use of scipy's [dendrogram function]( http://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.dendrogram.html).

An example use case:

| Code | Result |
| ------------- | ------------- |
| `import pylab as plt`
`from sklearn.datasets import load_iris`
` `
`from sklearn.cluster import AgglomerativeClustering`
`from sklearn.cluster.hierarchical import plot_dendrogram `
` `
`model = AgglomerativeClustering()`
`iris = load_iris()`
`model = model.fit(iris.data[:20])`
` plot_dendrogram(model)`
`plt.show()`| |

Please let me know if you find this useful, or if I should change anything!

Thanks!,
Mat