Session Ready
Exercise

Hierarchical clustering: ward method

It is time for Comic-Con! Comic-Con is an annual comic-based convention held in major cities in the world. You have the data of last year's footfall, the number of people at the convention ground at a given time. You would like to decide the location of your stall to maximize sales. Using the ward method, apply hierarchical clustering to find the two points of attraction in the area.

The data is stored in a Pandas data frame, comic_con. x_scaled and y_scaled are the column names of the standardized X and Y coordinates of people at a given point in time.

Instructions
100 XP
  • Import fcluster and linkage from scipy.cluster.hierarchy.
  • Use the ward method in the linkage() function.
  • Assign cluster labels by forming 2 flat clusters from distance_matrix.
  • Run the plotting code to see the results.