Search⌘ K
AI Features

Customer Segmentation

Explore the fundamentals of customer segmentation by applying the K-Means clustering algorithm. Understand how to choose the optimal number of clusters using the elbow method and visualize customer segments. This lesson guides you through implementing clustering techniques on marketing data to better segment and analyze customers.

There are a number of unsupervised clustering algorithms, but k-means is one of the easiest. It can segment an unlabeled dataset into a predetermined number of groups. The input parameter k stands for the number of clusters or groups we would like to form. However, if k is too small, then the centroids won’t lie within the clusters. But if k is too large, some of the clusters may be oversplit.

Implementing k-means clustering

The k-means algorithm follows these steps:

  1. Choose the number of clusters (k).

  2. Randomly assign centroids for each cluster.

  3. Assign each observation to a cluster for which the centroid is the closest based on the similarity or distance measures.

  4. Compute a new centroid for each cluster.

  5. Repeat steps 3 and 4 as long as the centroids keep changing.

The goal is to choose centroids that have the minimum sum of squares within the cluster.

Parameters:

  • ...