Exercise

Segment wholesale customers

You're now ready to use hierarchical clustering to perform market segmentation (i.e. use consumer characteristics to group them into subgroups).

In this exercise you are provided with the amount spent by 45 different clients of a wholesale distributor for the food categories of Milk, Grocery & Frozen. This is stored in the data frame customers_spend. Assign these clients into meaningful clusters.

Note: For this exercise you can assume that because the data is all of the same type (amount spent) and you will not need to scale it.

Instructions

100 XP
  • Calculate the Euclidean distance between the customers and store this in dist_customers.
  • Run hierarchical clustering using complete linkage and store in hc_customers.
  • Plot the dendrogram.
  • Create a cluster assignment vector using a height of 15,000 and store it as clust_customers.
  • Generate a new data frame segment_customers by appending the cluster assignment as the column cluster to the original customers_spend data frame.