Unsupervised learning: find structure without target labels
Unsupervised learning finds structure in data without supplied target labels for the task. Clustering groups similar observations; dimensionality reduction seeks a more compact representation.
The algorithm still has an objective. Without labels, the chosen representation, distance and assumptions become especially influential.
Group model representations
This scikit-learn example clusters illustrative embedding vectors. Normalizing them first makes direction more important than their original magnitude.
import numpy as np
from sklearn.cluster import KMeans
from sklearn.preprocessing import normalize
embeddings = np.array([[1., .1], [.9, .2], [.1, 1.], [.2, .9]])
unit_vectors = normalize(embeddings)
clusters = KMeans(n_clusters=2, n_init=10, random_state=7).fit_predict(unit_vectors)
The cluster numbers are arbitrary identifiers, not discovered topic names. A second run can permute them while representing the same partition.
Clustering also does not establish that the groups are the categories an application needs. Different distance measures, cluster counts or embedding models can produce different answers. Inspect representative examples and evaluate usefulness on the intended task, rather than treating a visually tidy map as a ground truth.