# clustering on multiple features and applying k-means

I am completely new to data science and this is a homework assignment so apologies beforehand. I have some raw data on restaurants that contain their categories (e.g. "Pizza", "Italian") and their coordinates. I'm to cluster them based on their coordinates for closeness and their categories for similarity using K-means. So far I've decided to vectorize the data from dictionary format into a NumPy/SciPy representation used by scikit-learn estimators. Something of this format:

['category=Pizza', 'category=Bars', 'cateogry=Italian', 'latitude', 'longitude']


However I'm having trouble scaling the vectors, since spatial coordinates and restaurant categories have different units of scale and there may be 20 different categories for a restaurant and only two features for latitude and longitude. I've attempted to use the skilearn preprocessing library but it is not providing meaningful clusters.

Any help is greatly appreciated.

• Are you being asked to use both the categories and the coordinates in the same clustering procedure, or as separate exercises? If they're separate exercises, your different data types are immaterial. – R Hill Oct 12 '16 at 21:02
• They are being used in the same clustering procedure. – user3538161 Oct 12 '16 at 21:12
• I would ask the person setting the assignment for clarification on that point, as this sounds like a very strange thing to do with k-means. – R Hill Oct 12 '16 at 21:22
• Extensions to k-means can be used for both categorical and numerical data. – SmallChess Oct 12 '16 at 22:15
• It seems unlikely that someone completely new to data science would be being asked to apply those extensions as a homework assignment. – R Hill Oct 13 '16 at 9:57