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

Agglomerative clustering in scikit-learn

Custom distance

Report a typo

Note that this task assumes scikit-learn version 1.2.2

You have the following starter code:

import numpy as np
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 = 4, random_state=42
)

Standardize the features. Fit the AgglomerativeClustering() model using the single linkage and the Manhattan metric. Predict the labels and calculate the adjusted Rand score between the predicted labels and the ground-truth labels. The answer should be the obtained adjusted Rand score, rounded to the second decimal place.

Enter a number
___

Create a free account to access the full topic