Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the correct library for clustering.
ML Python
from sklearn.cluster import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to fit the KMeans model on data X.
ML Python
model = KMeans(n_clusters=3) model.[1](X)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the code to get cluster labels after fitting.
ML Python
labels = model.[1]_ Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary of cluster sizes.
ML Python
cluster_sizes = {i: sum(labels [1] i) for i in range([2])} Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a dictionary of cluster centers with their coordinates.
ML Python
centers = {i: model.cluster_centers_[[1]] for [2], i in enumerate([3])} Drag options to blanks, or click blank then click option'
Attempts:
3 left