Clustering algorithms are frequently used in marketing for customer segmentation. This is a method of unsupervised learning that learns the commonalities between groups from data. Unlike supervised learning, where there is a target and a labeled variable that you would like to predict, unsupervised learning learns from data without any target or labeled variable. Among numerous other clustering algorithms, we are going to explore the usage of the k-means clustering algorithm in this chapter.
The k-means clustering algorithm splits the records in the data into a pre-defined number of clusters, where the data points within each cluster are close to each other. In order to group similar records together, the k-means clustering algorithm tries to find the centroids, which are the centers or means of clusters, to minimize the distances between the data points...