Complete the code to import the correct library for clustering.
from sklearn.cluster import [1]
The KMeans class is used for clustering, which is a common unsupervised learning method to find hidden patterns.
Complete the code to fit the KMeans model on data X.
model = KMeans(n_clusters=3) model.[1](X)
The fit method trains the KMeans model to find clusters in the data.
Fix the error in the code to get cluster labels after fitting.
labels = model.[1]_The correct attribute to get cluster labels after fitting is labels_.
Fill both blanks to create a dictionary of cluster sizes.
cluster_sizes = {i: sum(labels [1] i) for i in range([2])}We compare labels to each cluster index with == and count how many belong to each cluster in range 3.
Fill all three blanks to create a dictionary of cluster centers with their coordinates.
centers = {i: model.cluster_centers_[[1]] for [2], i in enumerate([3])}We use i to index cluster_centers_, idx as the loop variable, and iterate over range(3) for all clusters.
