Agglomerative Clustering in scikit-learn

Let's consider a more complex dummy dataset with 8 centers:

from sklearn.datasets import make_blobsnb_samples = 3000X, Y = make_blobs(n_samples=nb_samples, n_features=2, centers=8, cluster_std=2.0)

A graphical representation is shown in the following graph:

Dataset created for Agglomerative Clustering examples

We can now perform Agglomerative Clustering with different linkages (always keeping the Euclidean distance) and compare the results. Let's start with a complete linkage (AgglomerativeClustering uses the fit_predict(); method to train the model and transform the original dataset), also computing ...

Get Machine Learning Algorithms - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.