SciPy - Clustering and Distance
Given the code below, what will be the output of
labels?
import numpy as np from scipy.cluster.vq import kmeans, vq data = np.array([[1, 2], [1, 4], [1, 0], [10, 2], [10, 4], [10, 0]]) centroids, _ = kmeans(data, np.array([[1, 2], [10, 2]])) labels, _ = vq(data, centroids) print(labels.tolist())
