Computer scienceData scienceInstrumentsScikit-learnTraining ML models with scikit-learnClustering in scikit-learn

Agglomerative clustering in scikit-learn

The adjusted Rand score

Report a typo

Note that this task assumes scikit-learn version 1.2.2

You have the following starter code:

from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler
from sklearn.metrics.cluster import adjusted_rand_score

X, y = make_blobs(
    n_samples=1000, centers = 5, cluster_std=1, random_state=42
)

In the provided code, we generated 5 clusters (by passing centers = 5 to make_blobs()), thus, in this task, n_clusters should be set to 5.

Perform feature standardization. Predict the labels with AgglomerativeClustering() on the provided data with the complete linkage and calculate the adjusted Rand score for the ground truth and the predicted labels. The answer should contain the adjusted Rand score, rounded up to the third decimal.

Enter a number
___

Create a free account to access the full topic