15.7 Assigning Cluster labels

  • For hierarchical clustering, you can use the cutree function to cut the tree at a certain height to create clusters
  • For kmeans clustering, the clustering assignments is contained in the cluster object.

Both can be added back to the original data set, as long as the ordering has not changed

In this sample, we know the true clusters, so we can compare how well these methods did at capturing the similarities in companies.

Table 15.1: True cluster vs hierarchical (left) and kmeans (right) clustering.
1 2 3
Chem 3 11 0
Groc 2 4 0
Heal 1 0 4
1 2 3
Chem 0 10 4
Groc 0 4 2
Heal 4 0 1
  • Both methods clustered 4 out of 5 Health care companies together.
  • Both got grocery stores half wrong
  • Similar performance for clustering the chemical companies.