Python, Machine Learning, Clustering, K Means, Sklearn.
doesn’t work well with nonuniform shapes: from sklearn.datasets import make_moons # nonuniform shape X, _ = make_moons(n_samples=200, noise=0.05, random_state=0) model = KMeans(n_clusters=2) model.fit(X) labels = model.predict(X) # plot plt.scatter(X[:, 0], X[:, 1], c=labels)