I have 25 matrices 19x19 containing coherence measure between EEG electrodes. I want to divided them into some groups by clustering or any other method. I know how to deal with vectors, but I can't find anything about clustering of set of matrices. If it can help - I think we can use coherence as a distance between cells into matrix. So may be there are some method for clustering of distance matrices?


Traditional clustering methods cluster vectors. In the vector space, the distance metric and other distance functions are well defined. The Euclidean distance between vectors $x_1$ and $x_2$ is $|x_1-x_2|_2$, the 2-norm of $x_1-x_2$. Analogously, to compare two matrices $M_1$ and $M_2$, we may want to compute $|| M_1-M_2||_p$, the p-norm of $M_1-M_2$.


While there are two solution:

  1. Compute distance between matrices as sum of squares of the difference matrix
  2. Unwrap a triangle of each matrix into a vector

Is there something else?

  • 1
    $\begingroup$ Take a look at this paper. The authors develop a method for cluster temporal gene expression matrices in which rows are time series for gene expression. $\endgroup$
    – learner
    Feb 17, 2013 at 21:38

1 Answer 1


Since you have only 25 instances, I think hierarchical clustering is the way to go.

Not much more to say, until you've tried it - it's straightforward to use with any similarity, and with 25 instances, the bad scalability of O(n^3) is also irrelevant.

  • $\begingroup$ But, for example, linkage MATLAB function take Matrix with two or more rows. The rows represent observations, the columns represent categories or dimensions. But in my case observations is not 25 rows, is 25 matrices. Sorry for not clear question $\endgroup$
    – sviter
    Feb 17, 2013 at 19:50
  • $\begingroup$ Then try a different software that can process a distance matrix. $\endgroup$ Feb 17, 2013 at 23:24
  • $\begingroup$ Can you advise some function or method for build a distance matrix by computing pairwise distance among matrices? $\endgroup$
    – sviter
    Feb 18, 2013 at 6:07
  • 2
    $\begingroup$ @sviter, Why not you just unwrap a triangle of each matrix into a vector and then use some standard program which computes a (dis)similarity matrix between the vectors? $\endgroup$
    – ttnphns
    Feb 18, 2013 at 7:16
  • $\begingroup$ At 25 observations, there is nothing wrong in filling the 25x25 matrix by doing the n*(n-1)/2=300 dissimilarity computations yourself, and just writing them to the matrix. Then do the cluster analysis. In fact, it even is smart to compute the matrix only once, store it somewhere, so you can try different algorithms on it easily, as probably the similarity computation is much more expensive than the actual clustering. $\endgroup$ Feb 18, 2013 at 11:11

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.