I started with a dataset that contained many dimensions for individuals (each id is a separate individual), and extracted three Features/Attributes columns for each individual Id.

My goal is to bucket these individuals into two or three distinct groups, based on these features, to see if I can identify distinct separations between certain groups.

I was wondering if anyone has any recommendations, or algorithms (preferably in Python) that would cluster these individuals into distinct groups? I do not have these Individuals classified, so it's an unsupervised clustering problem. I was thinking that K-Means might be a good option, or something similar to PCA which could reduce my dimensionality and provide insight into the Features that seem to separate the groups of individuals into distinct groups.

Thanks for looking!

Note: The data shown below was artificially generated to illustrate my question.

enter image description here

Appendix: Reference Data:

Pattern,Feature A,Feature B,Feature C


2 Answers 2


Sounds like you are on the right track. There are many ways to attack this problem. If you want to visualize the clustering, it would help to reduce the data down to two components. This could be done via PCA or manifold learning if you want to go non-linear (http://scikit-learn.org/stable/modules/manifold.html).

In terms of clustering, there are many different methods to do this. Here are some comparisons of different methods: http://scikit-learn.org/stable/modules/clustering.html


Clustering is the process by which you create groups of similar items so that the difference between the items within groups is minimised and the difference between the items in different groups is maximised. Therefore, you are on the right track, as the previous answer already stated.

You could start by something simple, like k-means, and then keep improving your model depending on the results (another simple option is hierarchical clustering). However, there are several things that you should take into account. For instance, it may be advisable to normalise/standardise the data before clustering, so that the relative importance of all the features is the same. Additionally, some methods (like for instance k-means) require a priori knowledge of the number of groups in your data. Therefore, if you don't have such knowledge, you will have to decide how to test your clustering results for several numbers of clusters and how will you choose the best model.

PCA is not a clustering algorithm, but a dimensionality reduction algorithm. If your data has only three features, I don't really think that you would need PCA beforehand. Clustering methods based on distance metrics do not perform well in case of higher dimensional data (however, some tricks can still be used), but three features is not bad in that regard. However, applying PCA may be useful if you want to visualise the groups and your data. Once again, since you only have three features, just making a 3D plot may be enough.

Just start applying some methods, explore your data, and let the results help you decide what the next step is.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.