Skip to content
ml-recall

#cluster-distance

1 question from Clustering

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Short answer

easyAI-checkedClustering

K-Means can serve as a dimensionality-reduction step before a classifier. What does the last line print?

import numpy as np
from sklearn.cluster import KMeans

X = np.random.default_rng(0).random((400, 64))     # 400 images, 64 pixels each
kmeans = KMeans(n_clusters=50, n_init=1, random_state=0).fit(X)
print(kmeans.transform(X).shape)

A shape, e.g. (10, 3)