ComeçarComece de graça

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.

Este exercício faz parte do curso

Cluster Analysis in R

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Calculate Euclidean distance between customers
dist_customers <- ___

# Generate a complete linkage analysis 
hc_customers <- ___

# Plot the dendrogram


# Create a cluster assignment vector at h = 15000
clust_customers <- ___

# Generate the segmented customers data frame
segment_customers <- mutate(___, cluster = ___)
Editar e executar o código