Customer Segmentation (Clustering)
BasicGroup customers by yearly spending.
from sklearn.cluster import KMeans
X = [[200],[250],[800],[900],[1000],[1500]]
model = KMeans(n_clusters=2, n_init=10)
model.fit(X)
print(model.labels_)Loading...
🎉 Welcome to PyVerse - Your Ultimate Python Learning Platform!Welcome to PyVerse! Start Learning Today
from sklearn.cluster import KMeans
X = [[200],[250],[800],[900],[1000],[1500]]
model = KMeans(n_clusters=2, n_init=10)
model.fit(X)
print(model.labels_)