from sklearn.cluster import KMeans
model = KMeans(n_clusters=3)
labels = model.fit_predict(X)- Requires choosing K upfront — the 'elbow method' helps pick a good value
- Sensitive to feature scale and initial centroid placement
- Assumes roughly spherical, similarly-sized clusters