March 2019
Beginner to intermediate
464 pages
10h 57m
English
In this section, we are going to discuss different ways to draw insights from the results of the previous clustering analysis. Let's first build a k-means clustering model with 4 clusters. You can use the following code:
# Interpreting customer segmentscluster <- kmeans(normalizedDF[c("TotalSales", "OrderCount", "AvgOrderValue")], 4)normalizedDF$Cluster <- cluster$cluster
As you can see from this code, we are fitting a k-means clustering model with 4 clusters, based on the three attributes: TotalSales, OrderCount, and AvgOrderValue. Then, we store the cluster label information into a DataFrame, normalizedDF. This DataFrame is shown in the following screenshot:
The first thing we are going to look at is the ...
Read now
Unlock full access