# Clustering for multiple variable

There are total 50 students(john, Roy..) and used some action to do a job. My dataSet something like this

    John    Roy    Micheal   Ron  ....... Smith
A       B        B       A            C
A       A        C       B            B
C       A        A       B            B
.       .        .       .            .
.       .        .       .            .
.       .        .       .            .
F       G        E       A            G


Here A,B,C...G are strings. Final data is like this...

         A   B   C   D   E   F   G
John    3  34  23  34   4   3   1
Roy     5  23  12  3    5   39  46
...................................


This means John used "A" 3 times whereas Roy used "A" 5 times. So based on their action I want to cluster them (i.e. the student used the same number of activities will be in the same group).

Which clustering method can be used and how ?

## K-means

Your data has $7$ dimensions so k-means is worth to try. See the PCA of your data and check if any cluster is visible there as K-means will have a tough time if clusters are not Gaussian. the setup is:

• Each person is a point in $7D$ space (a $50\times7$ matrix)
• Apply PCA and inspect it.
• If different clusters visible then you will have a result

## Fuzzy C-Means

I would suggest soft clustering algorithms. Soft clustering means that output is not binary (each sample belong only to one cluster and does not belong to others) but it assigns a membership score for belongness of each sample to each cluster. It minimizes the same objective function as K-means but with a weight which is calculated in each iteration and can be found here. Libraries usually have this algorithm under the name FCM.

## K-means Through GMM

Another soft version of K-means is called Gaussian Mixture Models in which you try to estimate Gaussian kernels whose superposition describes the data (as you see again the Gaussian distribution of data is crucial here). The setup is:

• Choose a $k$ as the initial number of clusters and produce $k$ arbitrary Gaussian kernels (i.e. with arbitrary $\mu$ and $\sigma$)
• Use Expectation Maximization algorithm for updating the new clustering structure at each step.

## Spectral Clustering

Define a Similarity Matrix from the data by any means. For example calculate the distances between points in $7D$ space and reverse that. Or apply a RBF kernel for determining the similarity between them. Then calculate the second eigenvalue-eigenvector pair according to sorted eigenvalues. Use K-means to cluster those elements of eigenvectors.

If you have more detailed questions just drop a comment here. Good Luck!

• Thank you very much for your suggestion. Now, I am trying to create similarity measure using cosine similarity and residual sum of the square method. I am looking for a good article, document or tutorial. Can you please help me on this matter? Commented Jan 20, 2018 at 6:30
• I am glad it helped! A short visit to this onlinecourses.science.psu.edu/stat857/node/3 was promosing. This one looks good ncbi.nlm.nih.gov/pmc/articles/PMC4686108 . I am with mobile at the moment. As soon as I get to my laptop I will upate my answer with resources. Would you mind accepting the answer if it answered your question? Commented Jan 20, 2018 at 10:09
• HAC, PAM, CLARA, DBSCAN, OPTICS, LSDBC, HDBSCAN*, ... there is so much more. Commented Jan 29, 2018 at 15:31